prabudass has asked for the wisdom of the Perl Monks concerning the following question:

I need to "Extract all pages" from pdf files one by one and also i need to get the total number of pages from pdf files. Kindly advice me.

Thanks,
Prabudass

Replies are listed 'Best First'.
Re: Extract all pages from pdf
by marto (Cardinal) on Dec 16, 2008 at 10:32 UTC
Re: Extract all pages from pdf
by moritz (Cardinal) on Dec 16, 2008 at 10:32 UTC
    There are various tools out there that do things like this. One way is to convert the file to postscript, and then use ghostscript (short gs), the postscript swiss army chain saw. (Maybe it can even handle the PDF directly, I haven't tried that for quite some time).
Re: Extract all pages from pdf
by holli (Abbot) on Dec 16, 2008 at 11:57 UTC
Re: Extract all pages from pdf
by leocharre (Priest) on Dec 16, 2008 at 15:35 UTC
    Yo chex it, PDF::Burst, it's a wrapper to do it via perl.
Re: Extract all pages from pdf
by MidLifeXis (Monsignor) on Dec 16, 2008 at 15:59 UTC
      Yeah, the thing with PDF::API2 and CAM::PDF, is that I've found they may or may not work to do this on a certain architecture. PDF::Burst has the various methods to blow up a pdf doc into single pages. It uses PDF::API2, CAM::PDF, etc. So if one doesn't work, you use the other, same arguments, etc.
        I extracted all pages from pdf file using "PDF::Extract". If i open that extracted pdf it open correctly. But if i try to close it asked yes or no dialog box. Could you please explain how to rectify this problem.

        Code:
        use PDF::Extract;
        $pdf=new PDF::Extract( PDFDoc=>"C:\\sample.pdf");
        $i=1;
        $i++ while ( $pdf->savePDFExtract( PDFPages=>$i ) );

        Thanks,
        Prabudass