rob_au has asked for the wisdom of the Perl Monks concerning the following question:

I have what I hope is a relatively straight-forward question regarding the usage of PDF::API2.

I am currently using this module in a script which is intended to replace a commercial product in-use internally that simply doesn't meet all of our PDF creation requirements and for the most part, am most impressed with this module. I am however at a loss as to how to create bookmarks within a PDF document - This is a fundamental requirement for most of our PDF production and there is nothing relating to bookmarks within the PDF::API2 POD pages.

I was wondering if others had employed this module and incorporated the generation of bookmarks at all and if so could direct me as to how this can be implemented. Alternatively, I am welcome to other suggestions as to how to create bookmarks within a PDF document, although I would like to continue using PDF::API2 is possible given its wealth of other features.

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000001001001000"))'

Replies are listed 'Best First'.
Re: Generating bookmarks with PDF::API2
by zengargoyle (Deacon) on Apr 14, 2003 at 02:01 UTC

    Bookmarks are Outlines.

    use PDF::API2; $pdf = PDF::API2->open('PDB_TT_TimeVault.pdf'); $pdf->preferences( -outlines => 1 ); $page = $pdf->page(1); $otls = $pdf->outlines; $otl = $otls->outline; $otl->title('foo'); $otl->dest($page); $pdf->saveas('new.pdf');

    makes a 2 page pdf into a 3 page pdf and foo is a bookmark to the new page 1. i'm not quite sure of the proper usage.