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 121912 - Can't modify Outlines in existing document (+ maybe fixed)

  • 1 Replies
  • 626 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 387
    • View Profile
Sat May 27 09:08:07 2017 futuramedium [...] yandex.ru - Ticket created
Subject:    Can't modify Outlines in existing document (+ maybe fixed)

Code: [Select]
use strict;
use warnings;
use PDF::API2;

my $doc = PDF::API2-> open( 'sample.pdf' );

$doc-> outlines
    -> outline
        -> dest( $doc-> openpage( 1 ))
        -> title( '1st page' );

$doc-> saveas( 'sample+.pdf' );

Can't locate object method "outline" via package "PDF::API2::Basic::PDF::Objind" at outline.pl line 7.

This particular document has empty outlines structure (as opposed to not having it at all), but script will also fail if there's any existing outlines.

To fix, insert after line 2334 in API2.pm:

Code: [Select]
bless $obj, 'PDF::API2::Outlines';
$obj-> {' apipdf'} = $self-> { pdf };
$obj-> {' api' }   = $self;

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 387
    • View Profile
 PhilterPaper commented on Sep 30

See also RT 41971 (#5), which may be the same problem (returning Objind instead of Outlines object).

 PhilterPaper commented on Oct 1

Appears to be fixed by supplied patch, so closing. Will appear in release 3.008.