Skip Menu |

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

Report information
The Basics
Id: 117210
Status: rejected
Priority: 0/
Queue: PDF-API2

People
Owner: Nobody in particular
Requestors: regtapy [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.028
Fixed in: (no value)



Subject: Error: "can't call method "realise" on an undefined value" while open a pdf-file
Hello, system info: PDF::API2 VERSION 2.028 perl v5.10.1 FreeBSD 8.3-RELEASE-p3 I've got the error "Can't call method "realise" on an undefined value at /usr/local/lib/perl5/site_perl/5.10.1/PDF/API2.pm line 199." when I tried to open attached file (dr-hilton.pdf). The minimum code is: #!/usr/bin/perl use strict; use warnings; use PDF::API2; my $file = 'dr-hilton.pdf'; eval { my $src_pdf = PDF::API2->open( $file ) }; if ( $@ ) { warn "Error: $@"; } 1; Any ideas what's wrong with that? Thanks
Subject: dr-hilton.pdf
Download dr-hilton.pdf
application/pdf 183.2k

Message body not shown because it is not plain text.

It looks like the file is corrupt. At the end of the file (byte 187481), there's an "xref" line followed by "1 7". The 1 indicates that the first object number in the cross-reference table will be 1, and that there are 7 entries (the next seven lines). However, the next seven lines are numbered from 0 rather than 1. The "1 7" is invalid -- according to the spec, if there's only one cross-reference table (and this file only has one), it has to start with 0. PDF::API2 assumes that the 1 is intentional and doesn't return an error. Since Adobe Reader opens it without complaining, it looks like it assumes the 1 is a mistake and also doesn't return an error. If you change the "1 7" to "0 7", the file will open properly in both PDF::API2 and Adobe Reader. On Thu Aug 25 08:41:45 2016, NicReg wrote: Show quoted text
> Hello, > > system info: > PDF::API2 VERSION 2.028 > perl v5.10.1 > FreeBSD 8.3-RELEASE-p3 > > I've got the error "Can't call method "realise" on an undefined value > at /usr/local/lib/perl5/site_perl/5.10.1/PDF/API2.pm line 199." when I > tried to open attached file (dr-hilton.pdf). > > The minimum code is: > > #!/usr/bin/perl > > use strict; > use warnings; > > use PDF::API2; > > my $file = 'dr-hilton.pdf'; > eval { my $src_pdf = PDF::API2->open( $file ) }; > if ( $@ ) { > warn "Error: $@"; > } > > 1; > > Any ideas what's wrong with that? > Thanks