in reply to Re^3: blank pdf generated using PDF::API2 (Updated)
in thread blank pdf generated using PDF::API2

I do not have a pdf 100 pages

You mean you don't have an e-copy of Modern Perl?

Your code (with some adjustments for my elderly version of PDF::API2) works fine on my first edition of Modern Perl (186 pages).

  • Comment on Re^4: blank pdf generated using PDF::API2

Replies are listed 'Best First'.
Re^5: blank pdf generated using PDF::API2
by thanos1983 (Parson) on Jul 21, 2017 at 10:14 UTC

    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!

      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.