Skip Menu |

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

Report information
The Basics
Id: 114977
Status: open
Priority: 0/
Queue: PDF-API2

People
Owner: Nobody in particular
Requestors: dosio [...] land.it
Cc:
AdminCc:

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



Subject: Losing internal links while splitting document
Date: Thu, 2 Jun 2016 01:22:46 +0200
To: bug-PDF-API2 [...] rt.cpan.org
From: Claudio Dosio <dosio [...] land.it>
When I try to split into single pages some PDFs containing one of links, the links get lost in the split document. I have tried to use both the importpage() and the importPageIntoForm() with the same problem. I have tried the code snippet found in http://www.perlmonks.org/?node_id=982337 but in my case it doesn't work. I saw that this is a problem for many people but could not find any solution to the problem so far. I have tried on Linux Ubuntu 10.04, 12.04, 14.04 and the most recent 16.04. Could you please help me? Best regards, Claudio -- Claudio Dosio Responsabile R&S Software LAND S.r.l. Via di Affogalasino, 40 00148 ROMA RM Telefono +39 06 657481.1 Fax +39 06 657481.264 Web http://www.land.it http://www.securepaper.it Il contenuto di questa e-mail e' rivolto unicamente alle persone cui e' indirizzato, e puo' contenere informazioni la cui riservatezza e' tutelata. Come prescritto dal Garante per la Privacy con Deliberazione n.13 dell'1.03.2007, si informa che il messaggio inoltrato non e' di natura personale e che le risposte potranno essere conosciute nell'organizzazione di appartenenza del mittente. Sono vietati la riproduzione e l'uso di questa e-mail in mancanza di autorizzazione del destinatario. Se avete ricevuto questo e-mail per errore, vogliate cortesemente contattarci immediatamente per telefono al numero +39 06 6574811, al fax numero +39 06 657481264 o per e-mail all'indirizzo info@land.it
The code snippet given was for /merging/ pages into one PDF, so I don't know how applicable it is to your reported problem. Could you please give us a sample PDF (or refer to a public one) and the PDF::API2 code you use to split it, and shows the reported problem? Please also try it with PDF::Builder, in case code changes in that library have fixed the problem.
# If the original PDF contains links, they are lost in the copy. use PDF::API2; my $output_file = "copy.pdf"; my $output_pdf = PDF::API2->new(-file => $output_file); foreach my $input_file ("original.pdf") { my $input_pdf = PDF::API2->open($input_file); my @numpages = (1..$input_pdf->pages()); foreach my $numpage (@numpages) { # add page number $numpage from $input_file to the end of # the file $output_file $output_pdf->importpage($input_pdf,$numpage,0); } } $output_pdf->save();
Same with PDF::Builder.
What should the expected behavior be? After all, if you have an internal link that goes to a page that does not exist in the new document, presumably it should disappear. If pages are copied over one at a time, this would result in the loss of all off-page links. Maybe all links could be held in some cache, and at the end of the process, either destroyed (if out of document) or preserved. How about modifying a link to point to a new document, assuming all the pages survived some place or another? That could be quite a bit of manual work, unless you do the split and creation of multiple descendant documents all in one operation. This might be a new "partition" operation?