12345.001
12345.002
12346.001
12346.002
12346.003
The code is documentNumber.pageNumber. These are all TIFF files. If you change the extension to .tif and double click, any photo viewer software will open them. What I want them to be is PDF files where all the pages are in one file called 12345.pdf (with 2 pages) and 12346.pdf (with 3 pages). The 30,000 oddball documents should boil down to 10,000 pdf documents when the process is finished.
I had this identical problem in 2008 with the same stream of documents. Since then the provider changed to a pdf format but about a month ago they reverted to the prehistoric system. The provider cannot read the documents without an expensive reader provided by their contractor. My approach to the problem was to write a bat file to do the conversion. Unfortunately I don't know squat about writing batch files. All I knew was there had to be an approach that worked. Turned out I was right.
I went online to some forum and found some really helpful people. Here is the end result we (THEY) came up with.
That worked great in 2008. For some reason, it is not working today. You must do some set-up before using this file. You need a folder called c:/Test/SRC and one called c:/Test/DST. I have downloaded the tiffcp, tiff2pdf and the necessary .dll files and installed them. I put the .dll files into a c:/bin folder along with the tiffcp and tiff2pdf. When I run the bat from the command line prompt, I get a long series of error messages (I did in 2008, too). When the command prompt comes back there is a list of pdf files, properly numbered, in the DST folder. They are all 1 kb in size and they give an error when trying to open. Then I'll get a message that GNUWin32 has crashed. Then I'll get a message that tiff2pdf has crashed. I suspect there are .dll incompatibilities. I might have them in the wrong place or they might be different now than they were then. Or I might not have all I need.@echo off & setlocal EnableExtensions ENableDelayedExpansion
set oldpath=%PATH%
set PATH=%PATH%;c:\bin;
set SRC=c:\Test\SRC\
set DST=c:\Test\DST\
:: Commands are only echoed until %DEB% ist set to nothing
set DBG=ECHO/
::set "DBG="
pushd %SRC%
for /F "tokens=*" %%A in ('dir /B/A-D/ONE "*.001"') do (
set "PG="
for /F "tokens=*" %%B in (
'dir /B/A-D/ONE "%%~nA.0*"') do set PG=!PG! %%~nxB
tiffcp -c lzw !PG! %DST%%%~nA.TIF
tiff2pdf -o %DST%%%~nA.PDF %DST%%%~nA.TIF
DEL %DST%%%~nA.TIF
)
POPD
set PATH=%oldpath%
Is there someone here at BL/ATY who can help me to understand what the batch file does? And can someone help me figure out what isn't working?