libwkhtmltox
|
Provides C bindings for pdf conversion. More...
#include <wkhtmltox/dllbegin.inc>
#include <wkhtmltox/dllend.inc>
Typedefs | |
typedef struct wkhtmltopdf_global_settings | wkhtmltopdf_global_settings |
typedef struct wkhtmltopdf_object_settings | wkhtmltopdf_object_settings |
typedef struct wkhtmltopdf_converter | wkhtmltopdf_converter |
typedef void(* | wkhtmltopdf_str_callback) (wkhtmltopdf_converter *converter, const char *str) |
Function pointer type used for the error and warning callbacks. More... | |
typedef void(* | wkhtmltopdf_int_callback) (wkhtmltopdf_converter *converter, const int val) |
Function pointer type used for the progress_changed and finished callbacks. More... | |
typedef void(* | wkhtmltopdf_void_callback) (wkhtmltopdf_converter *converter) |
Function pointer type used for the phase_changed callback. More... | |
Functions | |
CAPI (int) wkhtmltopdf_init(int use_graphics) | |
Setup wkhtmltopdf. More... | |
CAPI (const char *) wkhtmltopdf_version() | |
Return a short utf8 description of a conversion phase. More... | |
CAPI (wkhtmltopdf_global_settings *) wkhtmltopdf_create_global_settings() | |
Create a new global settings object for pdf conversion. More... | |
CAPI (void) wkhtmltopdf_destroy_global_settings(wkhtmltopdf_global_settings *) | |
Destroy a global settings object. More... | |
CAPI (wkhtmltopdf_object_settings *) wkhtmltopdf_create_object_settings() | |
Create an object used to store object settings. More... | |
CAPI (wkhtmltopdf_converter *) wkhtmltopdf_create_converter(wkhtmltopdf_global_settings *settings) | |
Create a wkhtmltopdf converter object. More... | |
CAPI (long) wkhtmltopdf_get_output(wkhtmltopdf_converter *converter | |
Variables | |
const char * | name |
const char const char * | value |
const char char int | vs |
wkhtmltopdf_str_callback | cb |
wkhtmltopdf_object_settings * | setting |
wkhtmltopdf_object_settings const char * | data |
int | phase |
Provides C bindings for pdf conversion.
wkhtmltopdf_int_callback |
Function pointer type used for the progress_changed and finished callbacks.
For the progress_changed callback the value indicated the progress within the current phase in percent. For the finished callback the value if 1 if the conversion has successful and 0 otherwise.
converter | The converter that issued the callback |
val | The integer value |
wkhtmltopdf_str_callback |
Function pointer type used for the error and warning callbacks.
converter | The converter that issued the callback |
str | A utf8 encoded string containing the error or warning message. |
wkhtmltopdf_void_callback |
Function pointer type used for the phase_changed callback.
converter | The converter that issued the callback |
CAPI | ( | const char * | ) |
Return a short utf8 description of a conversion phase.
Return a short utf8 string indicating progress within a phase.
converter | The converter to query |
phase | The number of the conversion step of which we want a description |
Will typically return a string like "40%"
converter | The converter to query |
CAPI | ( | int | ) |
Setup wkhtmltopdf.
Return the largest HTTP error code encountered during conversion.
Get the total number of phases the conversion process will go trough.
Get the number of the current conversion phase.
Convert the input objects into a pdf document.
Retrieve a setting in a object settings object.
Alter a setting in a object settings object.
Retrieve a setting in a global settings object.
Alter a setting in a global settings object.
Deinit wkhtmltopdf.
Must be called before any other functions.
use_graphics | Should we use a graphics system |
Free up resources used by wkhtmltopdf, when this has been called no other wkhtmltopdf function can be called.
settings | The settings object to change |
name | The name of the setting |
value | The new value for the setting (encoded in UTF-8) |
settings | The settings object to inspect |
name | The name of the setting to read |
value | A buffer of length at least vs, where the value (encoded in UTF-8) is stored. |
vs | The length of value |
settings | The settings object to change |
name | The name of the setting |
value | The new value for the setting (encoded in UTF-8) |
settings | The settings object to inspect |
name | The name of the setting to read |
value | A buffer of length at least vs, where the value is stored (encoded in UTF-8). |
vs | The length of value |
This is the main method for the conversion process, during conversion progress information warning, and errors are reported using the supplied call backs. Once the conversion is done the output pdf (or ps) file will be placed at the location of the "out" setting supplied in the global settings object during construction of the converter. If this setting is not supplied or set to the empty string, the output can be retrieved using the wkhtmltopdf_get_output function.
\paragm converter The converter to perform the conversion on.
Conversion is done in a number of named phases, this function will retrieve the number of the current conversion phase, which will be a number between 0 and wkhtmltopdf_phase_count(converter)-1.
The description (name) of any phase can be retrieved by calling the wkhtmltopdf_phase_description method.
converter | The converter to find the current phase of |
converter | The converter to query |
Return the largest HTTP code greater than or equal to 300 encountered during loading of any of the supplied objects, if no such error code is found 0 is returned. This function will only return a useful result after wkhtmltopdf_convert has been called.
converter | The converter to query |
CAPI | ( | void | ) |
Destroy a global settings object.
add an object (web page to convert)
Set the function that should be called once the conversion has finished.
Set the function that should be called when progress have been done during conversion.
Set the function that should be called whenever conversion changes phase.
Set the function that should be called when an errors occurs during conversion.
Set the function that should be called when an warning message is issued during conversion.
Destroy a wkhtmltopdf converter object.
Normally one would not need to call this since ownership of the settings object is transfarred to the converter.
An object must be destroyed to free up its memory, once it has been destroyed it may no longer be accessed.
settings | The converter object to destroy |
converter | The converter object on which warnings we want the callback to be called |
cb | The function to call when warning message is issued |
converter | The converter object on which errors we want the callback to be called |
cb | The function to call when an error occurs |
The number of the new phase can be found by calling wkhtmltopdf_current_phase
converter | The converter which phase change events to call back from |
cb | The function to call when phases change |
The progress in percent within the current phase is given as an integer to the callback function.
converter | The converter which progress events to call back from |
cb | The function to call when progress has occurred. |
converter | The converter which finish events to call back from |
cb | The function to call when the conversion has finished has occurred. |
Add the object described by the supplied object settings to the list of objects (web pages to convert), objects are placed in the output pdf in the order of addition. Once the object has been added, the supplied settings may no longer be accessed, it Wit eventually be freed by wkhtmltopdf. If a none NULL and none empty utf8 encoded string is supplied to data, this HTML content will be converted instead of the content located at "page" setting of the supplied object settings instance.
converter | The converter to add the object to |
settings | The setting describing the object to add |
data | HTML content of the object to convert (encoded in UTF-8) or NULL |
CAPI | ( | wkhtmltopdf_converter * | ) |
Create a wkhtmltopdf converter object.
The converter object is used to convert one or more objects(web sides) into a single pdf. Once a settings object has been parsed, it may no longer be accessed, and will eventually be freed. The returned converter object must be freed by calling wkhtmltopdf_destroy_converter
settings | The global settings to use during conversion. |
CAPI | ( | wkhtmltopdf_global_settings * | ) |
Create a new global settings object for pdf conversion.
Create a new global settings object for pdf conversion, settings can be altered with wkhtmltopdf_set_global_setting, and inspected with wkhtmltopdf_get_global_setting. Once the desired settings have been set a converter object can be created using \reg wkhtmltopdf_create_converter.
CAPI | ( | wkhtmltopdf_object_settings * | ) |
Create an object used to store object settings.
Create a new Object settings object for pdf conversion, settings can be altered with wkhtmltopdf_set_object_setting, and inspected with wkhtmltopdf_get_object_setting. Once the desired settings have been set the object can be added to a converter by calling wkhtmltopdf_add_resource.
wkhtmltoimage_int_callback cb |
const char char * value |
const char char int vs |