DynaPDF Manual - Page 310

Previous Page 309   Index   Next Page 311

Function Reference
Page 310 of 839
LBOOL pdfCreateStructureTree(
const PPDF* IPDF) // Instance pointer
The function creates a global structure tree that is required to create Tagged PDF files. Tagged PDF
files require a root node of type Art, Div, Document, Part, or Sect. This function creates a root node
of type Document if nothing else was already imported. Other types can be created with the
function CreateStructureTreeEx().
DynaPDF is able to extend an existing structure tree that was imported from an external PDF
file. However, when editing external PDF files the following rules must be considered:
The structure information of a PDF file will only be imported when the entire PDF file is
imported with ImportPDFFile(). When importing single pages with ImportPage() or
ImportPageEx() of a PDF file that contains structure information then tagging will be
disabled because DynaPDF is not able to import the structure information of a PDF file
on a per page basis.
Import first the PDF file and call then CreateStructureTree(). The reverse order causes
that the structure tree will not be imported and tagging will be disabled!
Only one PDF file with structure information can be imported without invalidating the
structure information.
Keep in mind that the structure tree of a PDF file is a complex global structure that is
difficult to edit. Because of this, probably millions of PDF files exist that contain damages
in the structure tree, mostly due to editing actions in certain viewer applications. When
opening an existing page with EditPage() the function tries to find the corresonding
StructParents array of the page in the ParentTree of the document's Structure Tree. When
this action fails then tagging will be disabled for this page. OpenTag() and CloseTag() do
not produce further warnings in this case. The function GetIsTaggingEnabled() can be
used to determine whether tagging is still enabled after an existing page was opened for
When creating Tagged PDF files it is important to create the PDF file in the logical reading order.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is zero.

Previous topic: CreateStdPattern

Next topic: CreateStructureTreeEx, CreateSubmitAction