Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
typedef struct _DOCWRTPDFAUTOBOOKMARK
{
L_UINT uStructSize;
L_BOOL bUseStyles;
L_BOOL bBold;
L_BOOL bItalic;
L_DOUBLE dFontHeight;
L_CHAR szFaceName[ LF_FACESIZE
];
} DOCWRTPDFAUTOBOOKMARK, *pDOCWRTPDFAUTOBOOKMARK;
The DOCWRTPDFAUTOBOOKMARK structure provides information about creating automatic bookmark based on font information for PDF document.
Member |
Description |
|
uStructSize |
Size of this structure in bytes, for versioning. Use the sizeof() to calculate this value. |
|
bUseStyles |
Flag that indicates whether to consider font styles when creating document bookmark. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Consider font styles upon creation bookmark. |
|
FALSE |
Neglect font styles. |
bBold |
Flag that indicates whether to consider bold font style for the selected font while creating bookmark for PDF document. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Consider only bold font for the selected font type and size while creating bookmark for PDF document. |
|
FALSE |
Do not consider bold. |
bItalic |
Flag that indicates whether to consider italic font style for the selected font type and size while creating bookmark for PDF document. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Consider only italic font for the selected font type and size while creating bookmark for PDF document. |
|
FALSE |
Do not consider italic. |
dFontHeight |
The Font height to be considered for the font which will be used for creation bookmark in PDF document. |
|
szFaceName |
Specifies a null-terminated string that specifies the typeface name of the font. |
Comments
pDOCWRTPDFAUTOBOOKMARK is a pointer to a DOCWRTPDFAUTOBOOKMARKstructure. Declaring a pDOCWRTPDFAUTOBOOKMARK variable is necessary only if your program requires a pointer.
The Bookmarks feature allows for the creation of bookmarks, which can be used to mark parts of a document, for quick access. This can be done with documents that have been consistently formatted in outline or chapter form with sections and sub-sections, where each level uses unique font formatting to indicate each section.
When bUseStyles is TRUE this means to consider font styles, when considering unique fonts inside the document, for example in that case Arial bold and Arial will be handled as two different fonts.
Document Writer AutoBookmark feature will create bookmarks automatically for well structured documents that have unique fonts for its table of contents. The document must be constructed with this kind of convention in mind in order for the Auto book-marking feature to work properly. An example EMF document is shown in the following figure:
In the above figure we have the following fonts:
"Chapter": come with font: Arial17pt Bold
"Section": come with font: Tahoma 13pt
"Sub Section": come with font: Times New Roman 12pt Italic
To set the bookmarks for a document, first set the number of levels of bookmarks that you want. "Levels" represent the hierarchy of the bookmarks in the resultant bookmark outline. In our example there are three levels to be turned into bookmarks, so the number of Levels is 3.
For first level of bookmark, you should set the szFaceName to Arial and set bUseStyles to TRUE, with bBold equal to TRUE and bItalic equal to FALSE, and fontsize equal to 17.
For second level of bookmark, you should set the szFaceName to Tahoma and set bUseStyles to FALSE, and fontsize equal to 13.
For third level of bookmark, you should set the szFaceName to Times New Roman and set bUseStyles to TRUE, with bBold equal to FALSE and bItalic equal to TRUE, and fontsize equal to 12.
The resultant PDF document should be as following figure:
Notes:
The order of fonts is same as the order of levels (i.e. the first font will be in level 1, the 2nd in level 2 and so on).
Font selections should not conflict. Selecting "Arial" 17pt with same styles for both level1 and level2 will not work. Each level setting should be unique.
The maximum number of bookmarks cannot be greater than 10 levels and is limited by the number of unique fonts available in the loaded document. In the example used, it is limited to 3.
Before using the LEADTOOLS Document Writers SDK, unlock it by using the L_SetLicenseFile function. If you want to use the PDF format you must also unlock PDF support with the L_SetLicenseFile function.
This structure is used with the L_DocWriterConvert and L_DocWriterInit functions.