PhilterPaper / Perl-PDF-Builder

Extended version of the popular PDF::API2 Perl-based PDF library for creating, reading, and modifying PDF documents
https://www.catskilltech.com/FreeSW/product/PDF%2DBuilder/title/PDF%3A%3ABuilder/freeSW_full
Other
6 stars 7 forks source link

RT 129538 Updates to PDF 1.5+ files with cross reference stream are not rendering in Acrobat Reader #100

Closed PhilterPaper closed 5 years ago

PhilterPaper commented 5 years ago

Sat May 11 13:38:12 2019 david-dot-warring [...] gmail.org - Ticket created Subject: Updates to PDF 1.5+ files with cross reference stream are not rendering in Acrobat Reader

As reported in https://www.perlmonks.org/?node_id=1233444.

This is still a problem latest PDF::API2 blead. I have to do a bit more work to tickle it (e.g. adding a page) because the latest PDF::API2 now guards against null updates.

use PDF::API2;
my $pdf = PDF::API2->open("/tmp/test.pdf") or die $@;
my $page = $pdf->page;
my $font = $pdf->corefont('Helvetica-Bold');
$text = $page->text();
$text->font($font, 20);
$text->translate(200, 700);
$text->text('Test!');

$pdf->saveas("/tmp/test2.pdf");

With the attached test.pdf (for example), the output test2.pdf will fail in Adobe reader with "There was a problem reading this document (14)." test.pdf

Sat May 11 13:43:38 2019 david-dot-warring [...] gmail.org - Correspondence added

Note: I had the exact same bug in the Perl 6 PDF module, which I solved by re-outputting the cross reference table an cross reference stream on updates to PDF 1.5+ files. I am happy to submit on a PR for a similar solution here.

Sat May 11 13:52:04 2019 david-dot-warring [...] gmail.org - Correspondence added

Sorry I missed ticket 117184. Which already covers this issue and has some proposed solution. I'll reject this as a duplicate at watch that t ticket.

Sat May 11 13:52:04 2019 david-dot-warring [...] gmail.org - Status changed from 'new' to 'rejected'