3.14 PDF Objects
The PDF objects here refer to document-level objects a PDF contains, which are different from page-level objects associated with each PDF page, such as text, image and path. There are eight types of document-level object that can be created, modified and deleted using Right PDF SDK APIs: Boolean object, numerical object, string object, name object, array object, dictionary object, stream object, and null object. Here are some common APIs listed in Table 3.15. For a complete list of APIs, please refer to ZSObj.h.
Table 3.15
|
API Name |
Description |
1 |
ZSAtom_GetString |
Get the string associated with the specified atom. |
2 |
ZSAtom_FromString |
Get the atom for the specified string. |
3 |
ZSObj_Equal |
Determine whether two PDF objects are equal. |
4 |
ZSObj_Compare |
Compare two PDF objects. |
5 |
ZSObj_GetType |
Get the type of an object. |
6 |
ZSObj_GetBoolean |
Get Boolean value from a PDF object. |
7 |
ZSObj_GetDateTime |
Get the date value from a PDF object. |
8 |
ZSArray_NumElements |
Get a count of elements in an array. |
9 |
ZSArray_GetInteger |
Get an integer element in an array. |
10 |
ZSDict_HasKey |
Determine whether a specific key exists in a dictionary or not. |
11 |
ZSStream_GetDataa |
Get stream data. |
This is an example of using document-level APIs to set facing pages side by side in two columns.
Example: Set PageLayout to TwoColumnRight in a catalog dictionary.
ZSObj catalogObj;
ZSResult ret = ZSDoc_GetCatalog(doc, &catalogObj);
if (ret != ZS_OK)
{
return ret;
}
ZSAtom atomkey;
ZSAtom atomValue;
ZSAtom_FromString(“PageLayout”, &atomKey);
ZSAtom_FromString(“TwoColumnRight”, &atomValue);
ret = ZSDict_SetName(catalogObj, atomKey, atomValue, ZS_FALSE);
|