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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Long Distance Glider with sensational range!<br />

Fig. 8.9 Fitting a text line using leaders<br />

Generated output Option list for fit_textline( )<br />

a)<br />

Features of Giant Wing ....................................................<br />

Description of Long Distance Glider.................................<br />

Benefits of Cone Head Rocket .........................................<br />

boxsize={200 10}<br />

leader={alignment={none right}}<br />

b)<br />

+ + + + + + + + + Giant Wing in purple! + + + + + + + + +<br />

+ + Long Distance Glider with sensational range! + +<br />

+ + + + + Cone Head Rocket incredibly fast! + + + + +<br />

boxsize={200 10}<br />

position={center bottom}<br />

leader={alignment={left right}<br />

text={+ }}<br />

8.1.7 Text on a Path<br />

Instead of placing text on a straight line you can also place text on an arbitrary path.<br />

<strong>PDFlib</strong> will place the individual characters along the path so that the text follows the<br />

curvature of the path. Use the textpath option of fit_textline( ) to create text on a path.<br />

The path must have been created earlier and is represented by a path handle. Path handles<br />

can be created by explicitly constructing a path with add_path_point( ) and related<br />

path object functions, or by retrieving a handle for the clipping path in an existing raster<br />

image. The following code fragment creates a simple path and places text on the<br />

path (see Figure 8.10):<br />

/* Define the path in the origin */<br />

path = p.add_path_point( -1, 0, 0, "move", "");<br />

path = p.add_path_point(path, 100, 100, "control", "");<br />

path = p.add_path_point(path, 200, 0, "circular", "");<br />

/* Place text on the path */<br />

p.fit_textline("Long Distance Glider with sensational range!", x, y,<br />

"textpath={path=" + path + "} position={center bottom}");<br />

/* We also draw the path for demonstration purposes */<br />

p.draw_path(path, x, y, "stroke");<br />

Cookbook A full code sample can be found in the Cookbook topic text_output/text_on_a_path.<br />

Fig. 8.10<br />

Text on a path<br />

8.1 Placing and Fitting Textlines 205

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

Saved successfully!

Ooh no, something went wrong!