Advanced Search  :  Site Statistics  :  Directory  :  Web Resources  :  Polls  
    AccessPDF A PDF Forum for Users and Programmers    
 Welcome to AccessPDF
 Friday, May 09 2008 @ 09:19 AM PDT

Splitting and combining

   
Pdftk

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

Horst Schaeffer's Web site is http://home.mnet-online.de/horst.muc/

-- Robert Bull

 

What's Related

Story Options

 Copyright © 2008 AccessPDF
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.45 seconds