Subject: | importpage results in endless recursion (cross-reference-related?) |
The attached single-page PDF (which seems to be correct, as far as I can tell) results in an endless recursion when calling import_page with PDF::API2 version 2.028. With version 2.025 I get the message that cross-reference files are not supported, so the issue might be cross-reference-related.
I attached a minimal script to reproduce the issue (it's basically just calling import_page).
The stack trace might show the cause of the issue:
...
PDF::API2::Basic::PDF::File::read_objnum(ref(PDF::API2::Basic::PDF::File), undef, 0)
PDF::API2::Basic::PDF::File::read_objnum(ref(PDF::API2::Basic::PDF::File), undef, 0)
PDF::API2::Basic::PDF::File::read_objnum(ref(PDF::API2::Basic::PDF::File), undef, undef)
PDF::API2::Basic::PDF::File::read_obj(ref(PDF::API2::Basic::PDF::File), ref(PDF::API2::Basic::PDF::Array))
PDF::API2::Basic::PDF::Objind::realise(ref(PDF::API2::Basic::PDF::Array))
PDF::API2::importPageIntoForm(ref(PDF::API2), ref(PDF::API2), ref(PDF::API2::Page))
PDF::API2::import_page(ref(PDF::API2), ref(PDF::API2), 1)
Note that read_obj calls read_objnum with an undefined $num, which results in the endless recursion.
I guess at least read_objnum should return if called this way, so the endless recursion would not occur. Whether further things need to be fixed is beyond my insight...
Thanks for checking..!
Subject: | iPad_PDF_10.pdf |
Message body not shown because it is not plain text.
Subject: | test.pl |
#! /usr/bin/env perl
use PDF::API2;
use strict;
use warnings;
my $filename = shift or die "Usage: $0 <file.pdf>\n";
my $pdf = PDF::API2->open($filename);
my $out = PDF::API2->new();
my $out_page = $out->import_page( $pdf, 1 );