tags:

views:

842

answers:

7

Is there any Perl script to get the pages from a PDF file and convert the same to another PDF file?

+2  A: 

PdfTK.

~$ pdftk multi-page.pdf burst
gnud
A: 

Interactively, there is the full version of Acrobat. Programatically there is the Acrobat SDK from Adobe and lots of 3rd party solutions. Google Acrobat API.

MarkB
+1  A: 

Try PDFTron. They have a lot solutions.

Schwartser
+2  A: 

On OS X you can just do this in Preview, by dragging pages in the thumbnail view.

Peter Hilton
+1  A: 

As gnud already answered, pdftk is the best tool for the job. For example, to extract pages 5-10 from test.pdf to output.pdf you would write:

pdftk test.pdf cat 5-10 output.pdf

For the Windows version, you should download it from pdfhacks.com though, because the version there is newer than on accesspdf.com.
Most Linux distributions have it already on board or provide easy to install packages.

Andreas Thomas
+2  A: 

You asked for Perl, so here's a good solution via CAM::PDF. Say you just want pages 3-6 of orig.pdf to be saved to new.pdf:

deletepdfpage.pl orig.pdf 1-2,7- new.pdf
Chris Dolan
+1  A: 

The code given by Andreas didn't work for me. If using Pdftk, on Windows this formula worked for me :

pdftk source.pdf cat 123-128 output out.pdf dont_ask

Source being obviously the source pdf, 123-128 the intervall of pages to extract and out.pdf the new pdf.

anno