Re: Individual pages from complete PDF

"Mr. Shawn H. Corey" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.pdfapi2
Message-ID <[email protected]>
spinningwebz2002 wrote:
> After creating a document using PDF::API2, is there an "easy" way to 
> generate individual pages from the pdf I just created without having to 
> recreate the whole pdf?
> 
> For example I have just created and saved a pdf file 
> called "example.pdf"
> 
> I would like to open it and save page 1 as "example-1.pdf", page 2 
> as "example-2.pdf" etc.

  # not tested
  my $pdf->open('example.pdf');
  my $pages = $pdf->pages();
  for my $i ( 1 .. $pages ){
    my $newpdf = PDF::API2->new;
    my $page = $newpdf->importpage( $pdf, $i );
    $newpdf->saveas( "example-$i.pdf" );
  }


-- 
Just my 0.00000002 million dollars worth,
   Shawn

"For the things we have to learn before we can do them, we learn by doing them."
  Aristotle
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.