downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

PDF_create_field> <PDF_create_annotation
[edit] Last updated: Fri, 26 Apr 2013

view this page in

PDF_create_bookmark

(PECL pdflib >= 2.0.0)

PDF_create_bookmarkCreate bookmark

Description

int PDF_create_bookmark ( resource $pdfdoc , string $text , string $optlist )

Creates a bookmark subject to various options.



add a note add a note User Contributed Notes PDF_create_bookmark - [2 notes]
up
1
Anonymous
1 year ago
Bookmarks as URL

<?php
  $action
= $p->create_action("URI", "url=http://www.example.com");
 
$p->create_bookmark("www.example.com", "action {activate $action}");
?>

    OR

<?php
  $action
= pdf_create_action($p, "URI", "url=http://www.example.com");
 
pdf_create_bookmark($p, "www.example.com", "action {activate $action}");
?>

Bookmarks as GoTo

<?php
  $optlist
= "destination={page=1 type=fixed left=50 top=700 zoom=1}";
 
$action = $p->create_action("GoTo", $optlist);
 
$p->create_bookmark("page1", "action {activate $action}"); [snip]
?>

    OR

<?php
  $optlist
= "destination={page=1 type=fixed left=50 top=700 zoom=1}";
 
$action = pdf_create_action($p, "GoTo", $optlist);
 
pdf_create_bookmark($p, "page1", "action {activate $action}");
?>
up
-1
mryan *at* carleton *daught* edu
4 years ago
This function expects either basic ASCII or UTF-16 with a BOM (byte order mark) at the beginning of the string. Any other multibyte encoding (like UTF-8) will be treated as garbage, or in some situations may produce a fatal error.

Here's the solution I came up with, for making a bookmark from a UTF-8 string. The pack() function creates the BOM.

<?php
$bookmark
= 'a UTF-8 string';
$bookmark = pack('H*','feff').mb_convert_encoding($bookmark, 'UTF-16', 'UTF-8');
PDF_create_bookmark($p, $bookmark, '');
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites