I tried your code with two 24bit images, one interlaced the other not. It worked fine with the non-interlaced image but failed with the same error as yours for the interlaced image.
I was able to get it working by using GD to handle the image:
use GD;
# ...
my $imageFile = "image-24bit-interlaced.png";
my $gdimg = GD::Image->new($imageFile);
my $img = $pdf->image_gd($gdimg);
my $image = $page->gfx;
$image->image($img, 0/mm, 100/mm);
It produced a new PDF with the image placed. I did get a warning though:
libpng warning: Interlace handling should be turned on when using png_read_image
This is a bug in libpng addressed in
this discussion.
PS the module version you are using is very old - if you are planning to use it more you should update to the latest version. If you do you will need to update a few lines of your code also.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.