Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering.

RT 117184 - Can't call method "outobjdeep" in 2.026

  • 4 Replies
  • 1403 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 359
    • View Profile
RT 117184 - Can't call method "outobjdeep" in 2.026
« October 20, 2016, 08:35:44 PM »
Fri Mar 11 11:03:10 2016 profires [...] gmail.com - Ticket #112932: Ticket created
Subject:    Can't call method "outobjdeep" in 2.026
 
Hi,

I'm using the library on a simple script to update the info structure of pdf files.
References:
Perl version: strawberry version 5.18.2
OS: Windows 7 Enterprise

PDF input files are produced by a java program with PDF version 1.4 (and I never had problem with these).

The issue happens sometimes, when users add annotation with Acrobat Reader and this implies that the PDF version becomes 1.7 (according to the Acrobat Reader that they use)

After this modification we get the known old bug #48683, as we are using PDF-API2-2.021

I've just tried the new released PDF-API2-2.026 to check actual evolution and I obtain a new error message:
<<
Can't call method "outobjdeep" on an undefined value at D:/tm_programs/perl_portable_pdf/perl/site/lib/PDF/API2/Basic/PDF/Objind.pm line 170.
 
Below an extract from my sample script:
<<
Code: [Select]
my $pdf = PDF::API2->open($source) or die "Can't open PDF file $source: $!";
my $nowDate     = strftime( "%Y%m%d%H%M%S", localtime());

my  %h = $pdf->info(
        'CreationDate' => $nowDate,
    );
$pdf->saveas($source);

As this is my first time reporting a bug, please apologize for any mistake.
#
Tue Mar 15 15:07:43 2016 steve [...] deefs.net - Ticket #112932: Correspondence added
 
Are you able to attach a PDF that demonstrates this problem?  If you'd rather it not be publicly visible, you can instead send one to me privately.
#
Tue Mar 15 15:07:43 2016 The RT System itself - Ticket #112932: Status changed from 'new' to 'open'
#
Thu Mar 17 12:33:25 2016 profires [...] gmail.com - Ticket #112932: Correspondence added
Subject:    Re: [rt.cpan.org #112932] Can't call method "outobjdeep" in 2.026
Date:    Thu, 17 Mar 2016 16:33:03 +0000
To:    bug-PDF-API2 [...] rt.cpan.org
From:    Francesco Fiorentino <profires [...] gmail.com>
 
In attachment a sample.pdf where the attached perl script (test.pl) works correctly and a modified one (sampleMod.pdf) where I have the listed error message. The sampleMod is obtained adding an highlight with Adobe Reader XI and saving it.


*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 359
    • View Profile
Re: RT 117184 - Can't call method "outobjdeep" in 2.026
« Reply #1: October 20, 2016, 08:40:14 PM »
#
Tue Apr 26 04:07:46 2016 profires [...] gmail.com - Ticket #112932: Correspondence added
Subject:    Re: [rt.cpan.org #112932] Can't call method "outobjdeep" in 2.026
Date:    Tue, 26 Apr 2016 08:07:25 +0000
To:    bug-PDF-API2 [...] rt.cpan.org
From:    Francesco Fiorentino <profires [...] gmail.com>
 
Hi,

with the 2.027 released, I see that the error message is no more present, but, using the same input attached previously, it produces an unreadable file.

Thanks,
Francesco

#
Wed Jun 01 10:12:24 2016 profires [...] gmail.com - Ticket #112932: Correspondence added
Subject:    Re: [rt.cpan.org #112932] Can't call method "outobjdeep" in 2.026
Date:    Wed, 01 Jun 2016 14:12:03 +0000
To:    bug-PDF-API2 [...] rt.cpan.org
From:    Francesco Fiorentino <profires [...] gmail.com>
 
Any feedback about that?

#
Thu Jun 02 09:55:22 2016 steve [...] deefs.net - Ticket #112932: Correspondence added

I suspect that it's the same issue as ticket #113293.
#
Tue Jun 07 15:00:48 2016 MELMOTHX [...] cpan.org - Ticket #112932: Correspondence added
 
Actually, the issue seems unrelated. End of the modified PDF:

Code: [Select]
startxref
116
%%EOF
8 0 obj << /CreationDate (20160607205416) /Creator (Apache FOP Version 1.1) /ModDate (D:20160317171139+01'00') /PDFVersion (1.4) /Producer (Apache FOP Version 1.1) >> endobj
xref
0 1
0000000000 65535 f
8 1
0000009549 00000 n
trailer
<< /Type /XRef /DecodeParms << /Columns 4 /Predictor 12 >> /Filter /FlateDecode /ID [ <951086a159fa774291c81f007ad52c0e> <d0fd218e4aa35740b313e56bfd43b2db> ] /Index [ 9 18 ] /Info 8 0 R /Length 60 /Prev 116 /Root 10 0 R /Size 1 /W [ 1 2 1 ] >>
startxref
9723
%%EOF

It looks like the code just appends this code and keeps the original PDF verbatim, at first glance, hence the breakage.
#
Wed Aug 24 05:06:45 2016 dietrich.streifert [...] googlemail.com - Ticket created
Subject:    Simply opening and saving a multipage PDF file corrupts the file
Date:    Wed, 24 Aug 2016 11:06:30 +0200
To:    bug-PDF-API2 [...] rt.cpan.org
From:    Dietrich Streifert <dietrich.streifert [...] googlemail.com>
 
This is for perl 5.16 on centos 7.2 using a simple test file (filename "test.pdf" ) with four pages:

The following code
Code: [Select]
my $pdf   = PDF::API2->open("test.pdf");
$pdf->saveas("test-mod.pdf");
$pdf->end;
generates a corrupt file "test-mod.pdf" which is not readable any more by e.g. Acrobat Reader, which reports that the document can not be opened (code 14).

This behaviour makes PDF::API2 unusable for even the simplest modifications.

I've attached both the perl code and the test file (don't know if this gets through the email bug submission at rt.cpan.org)

#
Subject:    [rt.cpan.org #117184]
Date:    Wed, 24 Aug 2016 10:12:45 -0400
To:    bug-PDF-API2 [...] rt.cpan.org
From:    Phil M Perry
 
I see that the original test.pdf is PDF version 1.5. Maybe there's something in there that got corrupted when reading into PDF::API2. Is it possible to create your test.pdf in version 1.4 or even 1.3? Admittedly that's not a great solution -- PDF::API2 needs to be brought into the 21st century and handle up to version 1.7 correctly -- but it may do for the time being.
#
Wed Aug 24 10:13:02 2016 The RT System itself - Status changed from 'new' to 'open'
#
Wed Aug 24 10:27:59 2016 dietrich.streifert [...] googlemail.com - Correspondence added
Subject:    Re: [rt.cpan.org #117184]
Date:    Wed, 24 Aug 2016 16:27:45 +0200
To:    bug-PDF-API2 [...] rt.cpan.org
From:    Dietrich Streifert <dietrich.streifert [...] googlemail.com>
 
You're right! It works if I convert test.pdf to PDF-Version 1.4.
#
Thu Oct 06 23:34:09 2016 steve [...] deefs.net - Subject changed from 'Simply opening and saving a multipage PDF file corrupts the file' to 'Unable to write an opened PDF containing cross-reference streams'
#
Thu Oct 06 23:34:09 2016 steve [...] deefs.net - Severity Wishlist added
#
Thu Oct 06 23:42:42 2016 steve [...] deefs.net - Correspondence added

PDF::API2 got support for reading files with cross-reference streams in version 2.026, but it doesn't yet support writing those files.

The easiest way to implement this would be to convert the object stream to regular objects and save the file normally.  That would eliminate the need to teach PDF::API2 how to write a cross-reference stream, though that's the other option.  Doing so will typically produce a file that's a little smaller, but it isn't necessary.

As a workaround until someone adds that support, you can use importPageIntoForm to copy each page into a new PDF file, or use other copy methods to get the data from the original file to a new one.
#
Fri Oct 07 00:21:57 2016 steve [...] deefs.net - Ticket #112932: Correspondence added

On Thu Jun 02 09:55:22 2016, SSIMMS wrote:

Ok, not #113293, but it does appear to be the same as #117184.  sampleMod.pdf contains a cross-reference stream.  PDF::API2 can read them as of version 2.026, but it doesn't know how to write a cross-reference stream yet, nor how to convert from a cross-reference stream to a cross-reference table (which would likely be the easier of the two to implement).

A potential solution and a workaround are given in ticket #117184.
#
Fri Oct 07 00:22:50 2016 steve [...] deefs.net - Ticket #112932: Merged into ticket #117184
#
Fri Oct 07 00:22:50 2016 steve [...] deefs.net - Merged into ticket #117184

<formatting cleanup - Mod.>
« Last Edit: May 01, 2017, 10:52:53 AM by Phil »

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 359
    • View Profile
Re: RT 117184 - Can't call method "outobjdeep" in 2.026
« Reply #2: May 24, 2017, 05:49:52 PM »
Steve has rejected RT 120450 as a duplicate of this bug.
120450 reopened, closed as PATCHED
« Last Edit: December 25, 2017, 06:13:07 PM by Phil »

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 359
    • View Profile
Re: RT 117184 - Can't call method "outobjdeep" in 2.026
« Reply #3: July 03, 2017, 10:34:32 AM »
Sun Jul 02 23:45:57 2017 steve [...] deefs.net - Correspondence added

Possible solution in ticket 121832.

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 359
    • View Profile
Re: RT 117184 - Can't call method "outobjdeep" in 2.026
« Reply #4: December 25, 2017, 06:14:54 PM »
 PhilterPaper commented 1 Dec

A fundamental problem here is that cross-reference streams are PDF 1.5, while PDF::Builder (and API2) are supposed to be 1.4. It should refuse to read in a PDF 1.5 file until all 1.5 features are fully implemented! At any rate, it may be able to read these streams, but are not yet able to write them, so the former capability isn't terribly useful.