cpdf_add_outlineDescriptionAdds an outline (also known as a bookmark) for the current page. This is displayed in the bookmarks pane in most PDF readers and allows a user to quickly jump to the bookmarked page of the document. The function returns a outline identifier which can be used to denote the parent in another cpdf_add_outline() function call. lastoutline can either be 0 or an outline identifier from a previous use of cpdf_add_outline() . If a value of 0 is used, the bookmark is created at the top level. If a outline identifier is used, the entry will appear below the previously created outline. If sublevel is a non-zero value, the outline will be created as a child of lastoutline . In the eample below, the third outline has lastoutline pointing back to the first outline created, but because sublevel is 0, it is created on the same level as the first outline which is as a parent. This is the only way to make more than one parent outline that points to the same page. Specifying a value of 1 for the open parameter means that children bookmarks will be displayed folded out. A value of 0 means the bookmarks children will be hidden. ExampleExample 116. Create three outlines // start a PDF document $cpdf = cpdf_open(0, "test.pdf"); // create a 600x400 page cpdf_page_init($cpdf, 1, 0, 600, 400, 1); // write some text cpdf_begin_text($cpdf); cpdf_set_font($cpdf, "Helvetica", 18, "WinAnsiEncoding"); cpdf_show_xy($cpdf, "Hello World", 30, 400); cpdf_end_text($cpdf); // create the top level bookmark $level1 = cpdf_add_outline($cpdf, 0, 0, 1, 1, "Level 1"); // create a sub level bookmark $level1a = cpdf_add_outline($cpdf, $level1, 1, 1, 1, "Level 1a"); // create another top level bookmark again // note the reference to $level1 $level2 = cpdf_add_outline($cpdf, $level1 , 0, 1, 1, "Level 2"); // close and write document cpdf_finalize($cpdf); cpdf_close($cpdf);
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|