in reply to Re^4: blank pdf generated using PDF::API2
in thread blank pdf generated using PDF::API2

Hello hippo,

I have updated the script and tested it with 123 pages. The new pdf is just fine I do not understand why for lennelei is not working.

What is the updates that you applied? Your code (with some adjustments for my elderly version of PDF::API2) works fine on my first edition of Modern Perl (186 pages).

BR, Thanos.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^6: blank pdf generated using PDF::API2
by hippo (Archbishop) on Jul 21, 2017 at 10:30 UTC

    Here is the code with the changes to enable it to work with PDF::API2 2.020 (and removing the fixed page count)

    #!/usr/bin/perl use strict; use warnings; use PDF::API2; my $file='test.pdf'; my $newpdf = PDF::API2->new(); my $oldpdf = PDF::API2->open($file); if ($oldpdf->pages() > 1) { printf " (%d pages)\n", $oldpdf->pages(); for my $page_nb (1..$oldpdf->pages) { $newpdf->importpage($oldpdf, $page_nb, $page_nb); } $newpdf->saveas("test_2.pdf"); }

    One suspects that there is something peculiar about lennelei's PDF other than the number of pages which is causing it to have trouble. Without the real input data it will be hard to debug.

    Update: It appears that my spidey-sense is again uncannily prescient.