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.

4.4 String Handling in <strong>PDFlib</strong><br />

4.4.1 Content Strings, Hypertext Strings, and Name Strings<br />

PDF and operating system requirements impose different string handling in <strong>PDFlib</strong> depending<br />

on the purpose of a string. The <strong>PDFlib</strong> API uses the string types below. All relevant<br />

parameters and options are marked as content string, hypertext string, or name<br />

string in the <strong>PDFlib</strong> API Reference.<br />

Content strings, hypertext strings, and name strings can be used with Unicode and<br />

8-bit encodings.The details of string handling depend on the language binding, and are<br />

discussed in Section 4.4.2, »Strings in Unicode-aware Language Bindings«, page 109 .<br />

Content strings. Content strings are used to create genuine page content (page descriptions)<br />

according to the encoding chosen by the user for a particular font. All<br />

function parameters with the name text in the <strong>PDFlib</strong> API Reference for the page content<br />

functions fall in this class. Since content strings are represented with glyphs from a particular<br />

font, the range of usable characters depends on the font/encoding combination.<br />

Examples:<br />

The text parameters of show( ), fit_textline( ), add_textflow( ).<br />

Hypertext strings. Hypertext strings are used for interactive features such as bookmarks<br />

and annotations, and are explicitly labeled Hypertext string in the function descriptions.<br />

Many parameters and options of the functions for interactive features fall in<br />

this class, as well as some others. The range of characters which can be displayed depends<br />

on external factors, such as the fonts available to Acrobat and the operating system.<br />

Examples:<br />

fieldname option of add_table_cell( )<br />

name option of define_layer( )<br />

destname option of create_action( )<br />

text parameter of create_bookmark( )<br />

Name strings. Name strings: these are used for external file names, font names, block<br />

names, etc., and are marked as Name string in the function descriptions.Examples:<br />

filename parameters of begin_document( ) and create_pvf( )<br />

fontname parameter of load_font( )<br />

profilename parameter of load_iccprofile( )<br />

File names are a special case: the option filenamehandling specifies how <strong>PDFlib</strong> converts<br />

filenames supplied to the API to something which can be used with the local file system.<br />

4.4.2 Strings in Unicode-aware Language Bindings<br />

If a development environment supports the string data type and uses Unicode internally<br />

we call the binding Unicode-aware. The following <strong>PDFlib</strong> language bindings are Unicode-aware:<br />

> C++<br />

> <strong>COM</strong><br />

> .<strong>NET</strong><br />

> Java<br />

106 Chapter 4: Unicode and Legacy Encodings (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!