DynaPDF Manual - Page 582

Previous Page 581   Index   Next Page 583

Function Reference
Page 582 of 839
The function opens the specified tag so that contents can be written into it. When the corresponding
contents was drawn or output the tag must be closed with CloseTag(). The supported tags have the
same meaning as the corresponding HTML tags.
Many tags support additional attributes which cannot be set by this function. If additional attributes
should be set, use OpenTagEx() instead.
Tagged PDF files require a global structure tree that must be created with CreateStructureTree()
before this function can be called.
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.
Note that some tags require a bounding box, e.g. btFigure or btTable. Use OpenTagBBox()
to open such a tag.
The parameters Lang, AltText, and Expansion are all optional. The Lang parameter, if set, must be a
valid language identifier as defined in RFC 3066, Tags for the Identification of Languages. It overrides
the global language identifer that can be set with SetLanguage(). The main language of the
document should always be set with SetLanguage() when creating Tagged PDF files.

Previous topic: OpenTag

Next topic: OpenTagBBox, OpenTagEx