C interface changes for PDF Toolbox SDK
There are several changes in naming and behavior in the C interface to bear in mind when migrating from the 3-Heights® PDF Toolbox API to the PDF Toolbox SDK.
Prefixes
The name of all interface elements such as declared structs and functions, starts with a prefix. In 3-Heights® PDF Toolbox API PDF Toolbox API, all interface elements have the same prefix. The PDF Toolbox SDK introduces the following new prefixes:
Prefix | Area of usage |
---|---|
Ptx | Base prefix |
PtxGeom | Geometric related |
PtxGeomReal | For floating point numbers |
PtxGeomInteger | For integer numbers |
PtxPdf | General PDF related |
PtxPdfAnnots | Annotation related |
PtxPdfContent | Page content related |
PtxPdfForms | Form field related |
PtxPdfNav | Document navigation related |
The Sdk functions
License keys and product version
In 3-Heights® PDF Toolbox API, PdfSetLicenseKey
and PdfGetProductVersion
functions allows setting a license key and querying the version of the API.
In the, this functionality has been moved to the class TPtx_Sdk
. Specifically:
Ptx_Sdk_Initialize
must be called to set a license key. See also License keys.Ptx_Sdk_GetVersion
gets the API’s version number as a string.
The PDF Producer entry
In 3-Heights® PDF Toolbox API, when creating a PDF, the TPdfMetadata
object sets the PDF’s “Producer” entry via the related function PdfMetadataSetProducer
.
In the PDF Toolbox SDK, the class TPtxPdf_Metadata
has no related function PtxPdf_Metadata_SetProducer
. Instead, the “Producer” entry for all output PDFs is preconfigured as a string consisting of two parts:
- The first part (the “base” part) is encoded in the license key. Hence, this part is determined when buying a licensef rom Pdftools.
- The second part (the “suffix” part) is configured when calling
Ptx_Sdk_Initialize
as an argument. It is recommended to use the suffix solely for version information.
The assembled “Producer” entry can be obtained after calling Ptx_Sdk_Initialize
using the related function Ptx_Sdk_GetProducerFullName
.
Closing and releasing
In 3-Heights® PDF Toolbox API, all native objects support a “closing” operation by means of the PdfClose
function.
In the PDF Toolbox SDK, only the following classes support closing by means of a dedicated function:
TPtxPdf_Document
TPtxPdfContent_ContentGenerator
TPtxPdfContent_TextGenerator
Specifically, the objects on which these classes operate are not fully constructed until closing. For all other objects, associated resources can be freed by calling Ptx_Release
. Using an object after releasing results in undefined behavior.