We help IT Professionals succeed at work.
Get Started

pdftk.exe - Split existing PDFs into single pages - failing when run from a batch job...

2,934 Views
Last Modified: 2012-08-13
I have faxes that are converted to pdf files when they are received and are dumped to a network folder.

Many times, these pdf files have multiple pages.  I need to split the pages into individual pdf files so that they can be processed independantly from each other.

I am using the pdftk.exe utility.  When i run the command manually at the cmd line - it works fine.

example: pdftk.exe C:\Temp\folder1_original\Avaya-phones-value.pdf burst output C:\Temp\Folder2_Burst\Avaya-phones-value-%02d.pdf
Note:  the "%02d" variable will make name the pages with 01, 02, 03, etc in the name.

If i run the same command from within a batch file, the "%" sign in the output filename replaces the intended page numbers with the batch file name (C:\Temp\Folder2_Burst\Avaya-phones-value-C:\Temp\folder1_original\pdftk-burst.bat2d.pdf.

Does anyone have any ideas on how to avoid this?  Is there another way to specify the page numbers, or another variable, etc?  I have tried setting quotes around the output name in the batch file, but no luck.

Thanks
C:\Temp>pdftk.exe C:\Temp\folder1_original\Avaya-phones-value.pdf burst output C:\Temp\Folder2_Burst\Avaya-phones-value

C:\Temp>C:\Temp\folder1_original\pdftk-burst.bat

C:\Temp>pdftk.exe C:\Temp\folder1_original\Avaya-phones-value.pdf burst output C:\Temp\Folder2_Burst\Avaya-phones-value
Unhandled Java Exception:
java.io.FileNotFoundException: C:\Temp\Folder2_Burst\Avaya-phones-value-C:\Temp\folder1_original\pdftk-burst.bat2d.pdf:

   at 0x0056175e (Unknown Source)
   at 0x00561c52 (Unknown Source)
   at 0x00576914 (Unknown Source)
   at 0x0055f634 (Unknown Source)
   at 0x0061e044 (Unknown Source)
   at 0x005e65b2 (Unknown Source)
   at 0x005e33cc (Unknown Source)
   at 0x0055f54e (Unknown Source)
   at 0x0055f5f9 (Unknown Source)

C:\Temp>

Open in new window

Avaya-phones-value.pdf pdftk-burst.txt
Comment
Watch Question
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE