I'm trying to use PDF::API2 to turn a pdf document into many.
I am doing one doc out per page.
Thus, if the source is file.pdf, I want file_page1.pdf file_page2.pdf etc.

This is my test script..

#!/usr/bin/perl use strict; use PDF::API2; my $file_in = $ARGV[0]; my $prepend = $ARGV[1]; $prepend ||= 'out'; my $pdf_in = PDF::API2->open($file_in) or die; my $count = $pdf_in->pages; for my $i ( 0 .. ( $count - 1 )){ my $_i = ($i+1); my $file_out = "$file_in.$_i.pdf"; my $pdf_out = PDF::API2->new or die; $pdf_out->importpage( $pdf_in, $_i ) or die; $pdf_out->saveas($file_out) or die; print STDERR "saved $file_out\n"; } exit;

What's bugging me is that I get a PDF::API2 error..

leo@pony devel$ ./t/00bust.pl ./t/scan1.pdf 
Can't call method "outfilt" on an undefined value at /usr/lib/perl5/site_perl/5.8.8/PDF/API2/Util.pm line 688.

Is this a possible bug, or am I doing this wrong?
I tried a few different pdf sources, same trouble. Here's one pdf source I tried: http://web.aces.uiuc.edu/vista/pdf_pubs/ICESTORM.PDF

I have the latest PDF::API2 from cpan.

Update

Failure happens on i386 machine.

I tested on x86_64 machine with PDF::API2 version 2.006, worked. I updated to version 2.015, tried again and it worked fine- still. Must be something else then- a dep.. ..


In reply to PDF::API2 importpage problem by leocharre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.