Friday, July 08 2005 @ 03:48 AM PDT
Contributed by: Anonymous
Views: 12,743
I wanted to print the front pages ONLY of patents downloaded as PDFs. I couldn't work out how to do this with PDFTK in one pass, so I did as follows. This is in a COMMAND.COM DOS box (not CMD.EXE) under Windows 2000 and assumes a directory c:zdir that is clean apart from the particular PDFs under consideration. It uses Horst Schaeffer's wonderful LMOD (List MODifier) to make the batch files. The idea is to use PDFTK to split the first page only from each pdf, using LMOD to give them unique serial numbers, then a second pass with PDFTK to reassemble the new files into a single one, followed by a call to Acrobat Reader's command line function for printing (still have to press the OK button manually). Those "skilled in the art" will understand the rest; hope line wrapping and your system's odd habit of dropping backslashes doesn't screw things up too much.
PRPATPDF.BAT
------------
@echo off
c:dosutilspushd.exe
c:
cd c:zdir
for %%a in (do_it.bat pdf.dir front_pages.pdf $*.pdf) do if exist %%a del %%a > nul
dir *.pdf /O:N /N /b > pdf.dir
lmod /L* pdftk [] cat 1-1 output $[#].pdf do_it.bat
call do_it.bat
pdftk $*.pdf cat output front_pages.pdf
"C:Program FilesAdobeAcrobat 6.0ReaderAcroRd32.exe" /p "front_pages.pdf"
for %%a in (do_it.bat pdf.dir front_pages.pdf $*.pdf) do if exist %%a del %%a > nul
c:dosutilspopd.exe