10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

p.setfont(font, 24);p.show_xy("Hello, Tagged PDF!", 50, 700);p.continue_text("This PDF has a very simple");p.continue_text("document structure.");p.end_page_ext("");p.end_item(id);p.end_document("");Generating Tagged PDF with Textflow. The Textflow feature (see Section 7.2, »Multi-Line Textflows«, page 140) offers powerful features for text formatting. Since individualtext fragments are no longer under client control, but will be formatted automaticallyby PDFlib, special care must be taken when generating Tagged PDF with textflows:> Textflows can not contain individual structure elements, but the complete contentsof a single Textflow fitbox can be contained in a structure element.> All parts of a Textflow (all calls to PDF_fit_textflow( ) with a specific Textflow handle)should be contained in a single structure element.> Since the parts of a Textflow could be spread over several pages which could containother structure items, attention should be paid to choosing the proper parent item(rather than using a parent parameter of -1, which may point to the wrong parent element).> If you use the matchbox feature for creating links or other annotations in a Textflowit is difficult to maintain control over the annotation’s position in the structure tree.9.6.3 Activating Items for complex LayoutsIn order to facilitate the creation of structure information with complex non-linearpage layouts PDFlib supports a feature called item activation. It can be used to activate apreviously created structure element in situations where the developer must keep trackof multiple structure branches, where each branch could span one or more pages. Typicalsituations which will benefit from this technique are the following:> multiple columns on a page> insertions which interrupt the main text, such as summaries or inserts> tables and illustrations which are placed between columns.The activation feature allows an improved method of generating page content in suchsituations by switching back and forth between logical branches. This is much more efficientthan completing each branch one after the other. Let’s illustrate the activationfeature using the page layout shown in Figure 9.1. It contains two main text columns,interrupted by a table and an inserted annotation in a box (with dark background) aswell as header and footer.Generating page contents in logical order. From the logical structure point of view thepage content should be created in the following order: left column, right column (on thelower right part of the page), table, insert, header and footer. The following pseudo codeimplements this ordering:/* create page layout in logical structure order */id_art = p.begin_item("Art", "Title=Article");id_sect1 = p.begin_item("Sect", "Title={First Section}");9.6 Tagged PDF 219

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!