PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
path = p.add_path_point( -1, 0, 100, "move", "");<br />
path = p.add_path_point(path, 200, 100, "control", "");<br />
path = p.add_path_point(path, 0, 100, "circular", "");<br />
/* Visualize the path if desired */<br />
p.draw_path(path, x, y, "stroke");<br />
result = p.fit_textflow(tf, llx1, lly1, urx1, ury1,<br />
"wrap={paths={" +<br />
"{path=" + path + " refpoint={100% 50%} }" +<br />
"}}");<br />
p.delete_path(path);<br />
Use the inversefill option to wrap text inside the path instead of wrapping the text<br />
around the path (i.e. the path serves as text container instead of creating a hole in the<br />
Textflow):<br />
result = p.fit_textflow(tf, llx1, lly1, urx1, ury1,<br />
"wrap={inversefill paths={" +<br />
"{path=" + path + " refpoint={100% 50%} }" +<br />
"}}");<br />
Wrapping text around an image clipping path. TIFF and JPEG images can contain an<br />
integrated clipping path. The path must have been created in an image processing<br />
application and will be evaluated by <strong>PDFlib</strong>. If a default clipping path is found in the image<br />
it will be used, but you can specify any other clipping path in the image with the<br />
clippingpathname option of load_image( ). If the image has been loaded with a clipping<br />
path you can extract the path and supply it to the wrap option fit_textflow( ) as above.<br />
We also supply the scale option to enlarge the imported image clipping path:<br />
image = p.load_image("auto", "image.tif", "clippingpathname={path 1}");<br />
/* Create a path object from the image’s clipping path */<br />
path = (int) p.info_image(image, "clippingpath", "");<br />
if (path == -1)<br />
throw new Exception("Error: clipping path not found!");<br />
result = p.fit_textflow(tf, llx1, lly1, urx1, ury1,<br />
"wrap={paths={{path=" + path + " refpoint={50% 50%} scale=2}}}");<br />
p.delete_path(path);<br />
Placing an image and wrapping text around it. While the previous section used only<br />
the clipping path of an image (but not the image itself), let’s now place the image inside<br />
the fitbox of the Textflow and wrap the text around it. In order to achieve this we must<br />
again load the image with the clippingpathname option and place it on the page with fit_<br />
image( ). In order to create the proper path object for wrapping the Textflow we call info_<br />
image( ) with the same option list as fit_image( ). Finally, the reference point (the x/y parameters<br />
of fit_image( )) must be supplied to the refpoint suboption of the paths suboption<br />
of the wrap option:<br />
image = p.load_image("auto", "image.tif", "clippingpathname={path 1}");<br />
/* Place the image on the page with some fitting options */<br />
224 Chapter 8: Text and Table Formatting (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)