17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

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.

aerobatics. But it is best suited to gliding.<br />

fillcolor, charspacing,<br />

fontsize, fontname<br />

3. C one Head R ocket<br />

This paper arrow can be thrown with big swing. We launched it from<br />

the roof of a hotel. It stayed in the air a long time and covered a<br />

considerable distance.<br />

4. Super Dart<br />

The super dart can fly giant loops with a radius of 4 or 5 meters and<br />

cover very long distances. Its heavy cone point is slightly bowed<br />

upwards to get the lift required for loops.<br />

5. German Bi-Plane<br />

Brand-new and ready for take-off. If you have lessons in the history of<br />

aviation you can show your interest by letting it land on your teacher's<br />

desk.<br />

Fig. 8.13<br />

Formatting<br />

Textflows<br />

A multi-line Textflow can be placed into one or more rectangles (so-called fitboxes)<br />

on one or more pages. The following steps are required for placing a Textflow on the<br />

page:<br />

> The function add_textflow( ) accepts portions of text and corresponding formatting<br />

options, creates a Textflow object, and returns a handle. As an alternative, the function<br />

create_textflow( ) analyzes the complete text in a single call, where the text may<br />

contain inline options for formatting control. These functions do not place any text<br />

on the page.<br />

> The function fit_textflow( ) places all or parts of the Textflow in the supplied fitbox.<br />

To completely place the text, this step must possibly be repeated several times<br />

where each of the function calls provides a new fitbox which may be located on the<br />

same or another page.<br />

> The function delete_textflow( ) deletes the Textflow object after it has been placed in<br />

the document.<br />

The functions add/create_textflow( ) for creating Textflows support a variety of options<br />

for controlling the formatting process. These options can be provided in the function’s<br />

option list, or embedded as inline options in the text when using create_textflow( ). info_<br />

textflow( ) can be used to query formatting results and many other Textflow details. We<br />

will discuss Textflow placement using some common application examples. A complete<br />

list of Textflow options can be found in the <strong>PDFlib</strong> API Reference.<br />

Many of the options supported by add/create_textflow( ) are identical to those of fit_<br />

textline( ). It is therefore recommended to familiarize yourself with the examples in Section<br />

8.1, »Placing and Fitting Textlines«, page 199. In the below sections we will focus on<br />

options related to multi-line text.<br />

Cookbook Code samples regarding text output issues can be found in the text_output category of the<br />

<strong>PDFlib</strong> Cookbook.<br />

8.2.1 Placing Textflows in the Fitbox<br />

The fitbox for Textflow is the area where text will be placed. It is defined as the rectangular<br />

area specified with the llx, lly, urx, ury parameters of fit_textflow( ).<br />

Placing text in a single fitbox. Let’s start with an easy example. The following code<br />

fragment uses two calls to add_textflow( ) to assemble a piece of bold text and a piece of<br />

208 Chapter 8: Text and Table Formatting (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)

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

Saved successfully!

Ooh no, something went wrong!