PhilterPaper / Perl-PDF-Builder

Extended version of the popular PDF::API2 Perl-based PDF library for creating, reading, and modifying PDF documents
https://www.catskilltech.com/FreeSW/product/PDF%2DBuilder/title/PDF%3A%3ABuilder/freeSW_full
Other
6 stars 7 forks source link

[RT 125917] Issue with Annotation Link #91

Closed PhilterPaper closed 5 years ago

PhilterPaper commented 5 years ago

Tue Jul 24 10:29:40 2018 christine.hoogland [...] gmail.com - Ticket created

Date: Tue, 24 Jul 2018 16:29:11 +0200 To: bug-PDF-API2 [...] rt.cpan.org From: Christine Hoogland <christine.hoogland [...] gmail.com>

Hello,

Thanks for a great and useful library.

I'm using PDF-API2-2.033, perl v5.26.1 through Cygwin

I'm trying to add a table of content as first page in a pdf built with PDF::API2, ie to link some text to go to specific page, but it doesn't seem to work. Outlines/Bookmarks are OK and behave as expected. The link on the text seems to be there (cursor is changing aspect on mouse over the text) but it is not going anywhere.

my $annot = $contentpage->annotation;
my $page2 = $pdf->openpage(2);
$annot->link($page2,
       -rect   => [40, 750, 490, 764],
       -border => [1,1,1],
       -dest => $page2,
);

Is there anything missing in my code (full script and pdf produced attached) ?

Thanks a lot! Regards, Christine

test7.pdf outlines.pl.txt

PhilterPaper commented 5 years ago

I played with this for a bit, and indeed it's not working (on PDF::Builder). It uses the Annotation package "link" method instead of the Outlines "link", but the latter doesn't seem to work, either. It also has an option in the link method "-dest", but that is not supported. It needs to be investigated further. I would be surprised if there was no supported working way to build a TOC, as that is a fundamental operation in putting together a document! I'll have to look and see what wkHTMLtoPDF does to build a TOC (I think theirs works).

PhilterPaper commented 5 years ago

This turned out to be a fairly easy fix. If any options were given by the user, the default "fit" option failed to be set (-xyz [ undef undef undef ]). A little code rearrangement fixed that.

There are still a number of minor issues open with annotation; I plan to take another pass through it to make appearances and actions reasonably consistent, if I can. Done. See 117942 for information.