Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to extract all pages of several pdf's at the same time.

Now it does work with:

for %%I in (*.pdf) do "pdftk.exe" "%%I" burst

But I don't get all the pages, because for every new document he overwrites previous extracted pages.

So I tried:

for %%I in (*.pdf) do "pdftk.exe" "%%I" burst output "%%~nI_%02d.pdf"

But then it doenst work at all... Any ideas?

share|improve this question

Try the following to burst all PDF files of the current directory into numbered single-page PDF files:

@echo off

for %%F in (*.pdf) do call :burst "%%F"

goto xit

set name=%1
if not [%name:~1,5%]==[burst] (
  pdftk %1 burst output "burst_%~n1_%%04d.pdf"
  for %%d in (doc_data.txt) do del %%d
goto :EOF


The script prepends "burst_" to all generated filenames to avoid a clash between the original PDF files and the newly created ones. %%04d tells pdftk to add the page number as four digits with leading zeroes. Double % is needed to escape the CMD shell.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .