How to extract a page from a PDF file?

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

+7
perl pdf
source share
7 answers

You asked for Perl, so here is a good solution through CAM :: PDF . Say you just want pages 3-6 from the original to be saved in new.pdf:

deletepdfpage.pl orig.pdf 1-2,7- new.pdf 
+4
source share

PdfTK .

 ~$ pdftk multi-page.pdf burst 
+5
source share

In OS X, you can simply do this in preview mode by dragging and dropping pages as thumbnails.

+2
source share

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

 pdftk test.pdf cat 5-10 output out.pdf 
+2
source share

The code given by Andreas did not work for me. When using Pdftk on Windows, this formula worked for me:

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

Source, which is obviously the source of the pdf, 123-128 page spacing for extraction and out.pdf of the new pdf.

+1
source share

I believe in the actual code ... This code may be useful to you:

use CAM :: PDF;

my $ file_name = "abc.pdf";

my $ pdf = CAM :: PDF → new ($ file_name); my $ no_pages = $ pdf-> numPages ();

for (my $ i = 1; $ igetPageText ($ i); print "$ page \ n"; # may u can read its array / etc ... the manipulation can be done here}

+1
source share

Interactively, there is a full version of Acrobat. Programmatically there is an Acrobat SDK from Adobe and many third-party solutions. Google Acrobat API

0
source share

All Articles