Broken PDFs when opened in Acrobat when using egstate
Rick Measham <rick-6wk1kIbWGY9Wo+R/V/U2/[email protected]> Mon, 10 Mar 2008 20:03:53 +1100
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
I'm getting some really annoying behaviour and I'm hoping someone can work it out for me. (using cpan://A/AR/AREIBENS/PDF-API2-0.69.tar.gz) I want to overlay an almost-transparent number in a number of places on each page. I'm doing it using the following code: my $TRANSPARENT = $pdf->egstate; # Called just once $TRANSPARENT->transparency(0.9); ... $text->save; $text->egstate( $TRANSPARENT ); $text->font( $FONT_NUMBERS_FACE, $FONT_NUMBERS_SIZE ); $text->fillcolor( 'black' ); $text->translate( $PAGE_WIDTH - $right_margin, 0 ); $text->text_right( $photo_number ); $text->fill; $text->restore; However: * in kpdf, that is causing all subsequent text on that page to still use the egstate -- as if the restore wasn't there. * in Acrobat 8, that doesn't cause transparency at all, just a light grey that sits on top of everything. http://rick.measham.id.au/paste/whacked.pdf If I take out the egstate line, then it works just fine in both (but of course isn't transparent) http://rick.measham.id.au/paste/fine.pdf If I change all references to $gfx rather than $text, then it works just fine in kpdf, but Acrobat complains that the PDF has errors and I need to talk to whoever gave me the PDF. http://rick.measham.id.au/paste/broken.pdf Is there an option that I've missed that will let me set the numbers to almost-transparent that works in all (or at least Adobe's) PDF readers? Cheers! Rick Measham
smime.p7s
(application/x-pkcs7-signature, 3.2 KB) - not displayed