Skip Menu |

This queue is for tickets about the PDF-Reuse CPAN distribution.

Report information
The Basics
Id: 93049
Status: resolved
Priority: 0/
Queue: PDF-Reuse

People
Owner: cnighs [...] cpan.org
Requestors: jarrod [...] makin.co
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.36_03



Subject: PDF::Reuse Bookmarks bug and fix
Date: Sat, 15 Feb 2014 22:44:52 +0000
To: bug-PDF-Reuse [...] rt.cpan.org
From: Jarrod Makin <jarrod [...] makin.co>
I've recently been using PDF::Reuse to join several PDFs and bookmark where the joins occur. I have also been reading the article written at http://www.perl.com/pub/2007/09/20/pdf-processing-with-perl.html and using that author's code. Both seem to produce pdfs that aren't compatible with ALL pdf readers. I have attached a patch which produces working pdf in as many readers as I've tried (Android Adobe Reader, Fedora 20's Evince and Android Quickoffice). It simply changes the use of 'act' parameters to print out /Dest information rather than generate Javascript. -- Jarrod Makin jarrod@makin.co

Message body is not shown because sender requested not to inline it.

I'll target this for version 0.37 which should be out 1Q 2015.
I've added the suggested patch by hand since it no longer applies cleanly. The patched code is available on github and in zip'd form here: https://github.com/cnighswonger/PDF-Reuse/archive/bugs/93049.zip Please test and let me know if this fixes the issue. Once the fix is verified, I will push this with the next stable release.
On Mon Dec 08 12:17:29 2014, CNIGHS wrote: Show quoted text
> I've added the suggested patch by hand since it no longer applies > cleanly. The patched code is available on github and in zip'd form > here: > > https://github.com/cnighswonger/PDF-Reuse/archive/bugs/93049.zip > > Please test and let me know if this fixes the issue. Once the fix is > verified, I will push this with the next stable release.
Sadly, this still doesn't quite work. The variable $rad is immediately redefined after the useful part. The "/Dest [$code /XYZ null null null] " output needs to come slightly later too. I'll post a patch tomorrow.
This patch fixes the problem. It does the "/Dest" print later and it reverts to the previous regex.
Subject: PDF-Reuse.patch
--- /home/jarrod/rpmbuild/SOURCES/PDF-Reuse-0.37/Reuse.pm 2014-12-08 17:10:55.000000000 +0000 +++ /usr/share/perl5/PDF/Reuse.pm 2014-12-12 01:53:51.928936567 +0000 @@ -3279,15 +3279,6 @@ } } - if (exists $entry{'act'}) - { my $code = $entry{'act'}; -# if ($code =~ m/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/os) - if ($code =~ m/^\s*(\d+)\s*$/os) - { - $code = $1; - } - $rad = "/Dest [$code /XYZ null null null] "; - } $objekt[$me] = $pos; $rad = "$me 0 obj<<"; @@ -3298,6 +3289,14 @@ if (defined $jsObj) { $rad .= "/A $jsObj 0 R"; } + if (exists $entry{'act'}) + { my $code = $entry{'act'}; + if ($code =~ m/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/os) + { + $code = $1; + } + $rad .= "/Dest [$code /XYZ null null null] "; + } if (exists $entry{'previous'}) { $rad .= "/Prev $entry{'previous'} 0 R"; }
A better regex perhaps would be if ($code =~ m/(\d+)/os) as we're only interested in the first number.
On Thu Dec 11 21:17:14 2014, jarrod@makin.co wrote: Show quoted text
> A better regex perhaps would be > > if ($code =~ m/(\d+)/os) > > as we're only interested in the first number.
Ok, I've applied the patch you supplied and added the suggested regex improvement. This is all pushed up to github on the branch for this bug. If you would kindly test once more to see if the issue is resolved. Thanks very much for you help!
On Thu Dec 11 21:33:43 2014, CNIGHS wrote: Show quoted text
> Ok, I've applied the patch you supplied and added the suggested regex > improvement. This is all pushed up to github on the branch for this > bug. If you would kindly test once more to see if the issue is > resolved. > > Thanks very much for you help!
That's perfect, and you're welcome.