HTML to PDF converter for Java and .NET

<< back

PDF Bookmarks

PD4ML API provides a method to generate PDF bookmarks (outlines) either from H1-H6 heading structure or from named anchors.

pd4ml.generateOutlines(false); // from <a name="anchor name">...</a> 
pd4ml.generateOutlines(true); // from <H1>-<H6>
In the first case it produces a flat list of bookmarks:

Headings result a tree-like multilevel bookmark structure:

If some levels need to be excluded from the bookmarks tree, there is a special CSS property / HTML attribute for that:

H3 { pd4ml-bookmark-visibility: hidden } 
( or <h3 pd4ml-bookmark-visibility="hidden"> if  you need to suppress a single bookmark)



<pd4ml:bookmark> proprietary tag

With v3.9.0 PD4ML introduces a  new <pd4ml:bookmark> tag, which makes possible to define a multi-level PDF document outline/bookmark structure (as an alternative to described above headings <H1>-<H6> and named anchors). The approach siplifies a structure maintenance and offers some previously unavailable features, like bookmark references to external URL resources.

	<pd4ml:bookmark name="Bookmark group 1" href="#bm1"> <!-- href points to a named anchor -->
		<pd4ml:bookmark name="bookmark 1.1" href="#bm2"/>
		<pd4ml:bookmark name="bookmark 1.2" href="#bm3"/>
	<pd4ml:bookmark name="Bookmark group 2"> <!--bookmark container - no destination href -->
		<pd4ml:bookmark name="bookmark 2.1" href="#bm3"/>
		<pd4ml:bookmark name="bookmark 1.2" href="#bm4"/>
		<pd4ml:bookmark name="bookmark 2.3" href=""/><!-- bookmark refers to an external URL -->
		<pd4ml:bookmark name="bookmark 2.4" href="#bm5">
			<pd4ml:bookmark name="bookmark 2.4.1" href="#bm6"/>
			<pd4ml:bookmark name="bookmark 2.4.2" href="#bm7"/>

Copyright ©2004-22 zefer|org. All rights reserved. Bookmark and Share