Calling text->fillcolor with an undefined value breaks the PDF in Adobe
Reader (Win & Linux). ie. all white screen, images or graphix don't
display. The PDF displays fine in chrome and okular.
The attached script creates 2 pdfs, one broken, one not. I'm not sure
that this should be considered a bug in PDF::API2 or actually a bug in
Adobe Reader.. but damn it was hard to track down. oh, Photoshop wouldn't
open the file either so maybe it's just all Adobe products..
Subject: | fillcolor_test.pl |
#!/usr/bin/perl
use PDF::API2;
my ($pdf, $page, $font, $text);
$pdf = PDF::API2->new( -file => 'test_fillcolor_ok.pdf' );
$page = $pdf->page;
$page->mediabox(0, 0, 595, 842);
$font = $pdf->corefont('Helvetica');
$text = $page->text;
$text->font($font, 14);
$text->text('ello dere');
$pdf->save;
$pdf = PDF::API2->new( -file => 'test_fillcolor_nok.pdf' );
$page = $pdf->page;
$page->mediabox(0, 0, 595, 842);
$font = $pdf->corefont('Helvetica');
$text = $page->text;
$text->fillcolor(undef); # ***
$text->font($font, 14);
$text->text('ello dere');
$pdf->save;