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 or logging in.

RT 125917 - Issue with Annotation Link

  • 2 Replies
  • 245 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 417
    • View Profile
RT 125917 - Issue with Annotation Link
« July 24, 2018, 07:47:44 PM »
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.
Code: [Select]
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

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 417
    • View Profile
Re: RT 125917 - Issue with Annotation Link
« Reply #1: September 05, 2018, 11:02:33 AM »
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).

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 417
    • View Profile
Re: RT 125917 - Issue with Annotation Link
« Reply #2: October 02, 2018, 06:32:07 PM »
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.