Vanilla.PDF
1.4.0
Cross-platform toolkit for creating and modifying PDF documents
|
The library exposes native C-style interface to allow interoperability with most languages. All handles are basically opaque pointers to internal structures, which are meant to be modified using the only the API and not the structures themselves.
All of the basic interface types are either opaque pointers to internal structures or simply standard value types such as integers or strings.
Since boolean type is not supported in the C-style interface, we have a custom definition of boolean_type with only two possible states - VANILLAPDF_RV_TRUE and VANILLAPDF_RV_FALSE.
For more detailed information please visit Types.
All interface objects are reference counted. Whenever an object is received with an output parameter, it has to be released when no longer needed.
After the file has been opened successfully, the caller is responsible for calling appropriate release function. Calling the release multiple times is an error and causes undefined behavior. We recommend resetting the handles to their initial state of NULL, to prevent any errors.
For example this macro may help in maintaining consistent state of the local variables:
With this helper macro, the cleanup becomes easier as long as it is properly initialized with NULL.
It is also safe to call this release macro several times. This code style may seem repulsive for some developers, they are free to use any kind of cleanup, as long as it serves the purpose.
Every function throughout the interface returns error_type. On success, the return value should be VANILLAPDF_ERROR_SUCCESS. In every other case it means that an error has occurred and it's error message is stored. The next section explains how to gather this message.
There is a code sample how to obtain the last error code with the message printed to console.
For more detailed information please visit Errors.
Sometimes the error code and message is not enough to solve the problem. Library also supports logging, that can be configured via Logging. Logging have multiple log levels, which control the verbosity of the output.
Following snippet enables the logging feature with the highest possible logging severity.
For more useful utilities please visit Utilities.