Skip Menu |
 

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

Report information
The Basics
Id: 120450
Status: resolved
Priority: 0/
Queue: PDF-API2

People
Owner: Nobody in particular
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.032



X-RT-Interface: Web
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 583
Download (untitled) / with headers
text/plain 583b
Version 2.031. $ perl -MPDF::API2 -e 'PDF::API2->open("t/4pages.pdf")->saveas("pa.pdf")' Can't use an undefined value as an ARRAY reference at /Library/Perl/5.12/PDF/API2/Basic/PDF/File.pm line 1276. I was just trying to rewrite a file that another PDF module couldn’t read (to see if that would make it readable by the other module). The documentation implies that this should work. I encountered this problem with PDFs generated by Mac OS X 10.8.5 Quartz PDFContext and those generated by ABBYY FineReader. (I.e., it does not seem specific to any particular PDF generator.)
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-1836-1488262616-1711.120450-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 119
Download (untitled) / with headers
text/plain 119b
Sorry, I forgot the subject, but I don’t have permission to set it. It should be: ->open followed by ->saveas fails
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-29628-1495592377-629.120450-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 116
Download (untitled) / with headers
text/plain 116b
This is a known issue with cross-reference streams, which are currently read-only in PDF::API2 (dup. of RT #117184).
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-29628-1495592377-629.120450-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org> <rt-4.0.18-29628-1495592377-629.120450-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1495662938-31487-2"
Message-ID: <rt-4.0.18-31487-1495662938-1838.120450-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 408
Download (untitled) / with headers
text/plain 408b
On Tue May 23 22:19:37 2017, SSIMMS wrote: Show quoted text
> This is a known issue with cross-reference streams, which are > currently read-only in PDF::API2 (dup. of RT #117184).
The PDF I tested with is a 1.3 file, here attached. It seems to be the combination of ‘open’ followed immediately by ‘saveas’ that does not work. If it is not designed to work that way, would you consider improving the documentation?
MIME-Version: 1.0
Subject: 4pages.pdf
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/pdf; name="4pages.pdf"
Content-Disposition: inline; filename="4pages.pdf"
Content-Transfer-Encoding: base64
Content-Length: 8586
Download 4pages.pdf
application/pdf 8.3k

Message body not shown because it is not plain text.

MIME-Version: 1.0
Subject: [PATCH] for ->saveas not working
In-Reply-To: <rt-4.0.18-31487-1495662938-1838.120450-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
References: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org> <rt-4.0.18-29628-1495592377-629.120450-0-0 [...] rt.cpan.org> <rt-4.0.18-31487-1495662938-1838.120450-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1498088243-29006-3"
Message-ID: <rt-4.0.18-29006-1498088243-398.120450-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
RT-Send-CC: steve [...] deefs.net
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 510
Download (untitled) / with headers
text/plain 510b
On Wed May 24 17:55:38 2017, SPROUT wrote: Show quoted text
> On Tue May 23 22:19:37 2017, SSIMMS wrote:
> > This is a known issue with cross-reference streams, which are > > currently read-only in PDF::API2 (dup. of RT #117184).
> > The PDF I tested with is a 1.3 file, here attached. > > It seems to be the combination of ‘open’ followed immediately by > ‘saveas’ that does not work. If it is not designed to work that way, > would you consider improving the documentation?
This patch seems to solve the problem.
MIME-Version: 1.0
Subject: open_QMs6IgBI.txt
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: text/plain; charset="utf-8"; name="open_QMs6IgBI.txt"
Content-Disposition: inline; filename="open_QMs6IgBI.txt"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 939
Download open_QMs6IgBI.txt
text/plain 939b
--- a/lib/PDF/API2/Basic/PDF/File.pm 2017-01-26 10:30:03.000000000 -0800 +++ b/lib/PDF/API2/Basic/PDF/File.pm 2017-06-21 16:33:17.000000000 -0700 @@ -1273,7 +1273,7 @@ my $tloc = $fh->tell(); $fh->print("xref\n"); - my @xreflist = sort { $self->{' objects'}{$a->uid}[0] <=> $self->{' objects'}{$b->uid}[0] } (@{$self->{' printed'}}, @{$self->{' free'}}); + my @xreflist = sort { $self->{' objects'}{$a->uid}[0] <=> $self->{' objects'}{$b->uid}[0] } (@{$self->{' printed'}||[]}, @{$self->{' free'}||[]}); my ($i, $j, $k); unless ($update) { @@ -1294,7 +1294,7 @@ } } - my @freelist = sort { $self->{' objects'}{$a->uid}[0] <=> $self->{' objects'}{$b->uid}[0] } @{$self->{' free'}}; + my @freelist = sort { $self->{' objects'}{$a->uid}[0] <=> $self->{' objects'}{$b->uid}[0] } @{$self->{' free'}||[]}; $j = 0; my $first = -1; $k = 0; for ($i = 0; $i <= $#xreflist + 1; $i++) {
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-29006-1498088243-398.120450-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-561-1488262544-607.0-0-0 [...] rt.cpan.org> <rt-4.0.18-29628-1495592377-629.120450-0-0 [...] rt.cpan.org> <rt-4.0.18-31487-1495662938-1838.120450-0-0 [...] rt.cpan.org> <rt-4.0.18-29006-1498088243-398.120450-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-18831-1498322936-113.120450-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 666
Download (untitled) / with headers
text/plain 666b
Aha, you're right. Thanks for the patch. I've implemented it and added a test case. On Wed Jun 21 19:37:23 2017, SPROUT wrote: Show quoted text
> On Wed May 24 17:55:38 2017, SPROUT wrote:
> > On Tue May 23 22:19:37 2017, SSIMMS wrote:
> > > This is a known issue with cross-reference streams, which are > > > currently read-only in PDF::API2 (dup. of RT #117184).
> > > > The PDF I tested with is a 1.3 file, here attached. > > > > It seems to be the combination of ‘open’ followed immediately by > > ‘saveas’ that does not work. If it is not designed to work that way, > > would you consider improving the documentation?
> > This patch seems to solve the problem.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.