in reply to Image errors with PDF::API2;

G'day djlerman,

It would be useful if you supplied some simple code demonstrating the generation of these errors. Also, please let us know the version of PDF::API2 that you are using; other similar information, such as Perl version and OS may be helpful.

I had a look at the source: https://metacpan.org/release/SSIMMS/PDF-API2-2.042/source/lib/PDF/API2/Resource/XObject/Image/PNG.pm. The line numbers you show don't seem to fit the messages (so you're probably not using the latest 2.042 version).

I did note at lines 84-89:

# BPC = bits per component, and may be 1, 2, 4, 8, or 16 per the PNG s +pec. # Color types may further restrict the available options. Additionall +y, # this module doesn't currently support 16-bit components. if ($bpc == 16) { die '16-bit colors/transparency are not supported.'; }

That was the only thing that matched a search for "not supported". Have a look around your own version of the source code: searching for "not supported" or "Unsupported" may shed some light on the problem.

— Ken

Replies are listed 'Best First'.
Re^2: Image errors with PDF::API2;
by djlerman (Beadle) on Nov 16, 2021 at 18:54 UTC
    Thank You Ken. :-)

    PDF::API2 -- 2.021
    perl -- v5.10.1 (*) built for x86_64-linux-thread-multi
    os -- CentOS release 6.5


    Here is code:
    use PDF::API2; use constant mm => 25.4 / 72; use constant in => 1 / 72; use constant pt => 1; # Create a blank PDF file my $pdf = PDF::API2->new(); # Add a blank page my $page = $pdf->page(); # Set the page size $page->mediabox('Letter'); $pdf->info( 'Author'=>'COPA', 'Title'=>'perl PDF API2 Test', ); $imageFile = "/home/images/test.png"; $img = $pdf->image_png($imageFile); $image = $page->gfx; $image->image($img, 0/mm, 100/mm); # print output $http_headers_out{'Content-Disposition'} = "inline; filename=pdfTes +t.pdf"; $http_headers_out{'Content-type'} = "application/pdf"; $escmode = 0; print OUT $pdf->stringify; $pdf->end;