libwkhtmltox: Main Page

libwkhtmltox

libwkhtmltox Documentation

libwkhtmltox is divided into several parts.

# To PDF c-bindings

The file pdf.h contains a fairly high level and stable pure c binding to wkhtmltopdf. These binding are well documented and do not depend on QT. Using this is the recommended way of interfacing with the PDF portion of libwkhtmltox.

Using these binding it is relatively straight forward to convert one or more HTML document to a PDF file, using the following process:

- wkhtmltopdf_init is called.
- A wkhtmltopdf_global_settings object is creating by calling wkhtmltopdf_create_global_settings.
- Non web page specific Setting for the conversion are set by multiple calls to wkhtmltopdf_set_global_setting.
- A wkhtmltopdf_converter object is created by calling wkhtmltopdf_create_converter, which consumes the global_settings instance.
- A number of object (web pages) are added to the conversion process, this is done by
  - Creating a wkhtmltopdf_object_settings instance by calling wkhtmltopdf_create_object_settings.
  - Setting web page specific Setting by multiple calls to wkhtmltopdf_set_object_setting.
  - Adding the object to the conversion process by calling wkhtmltopdf_add_object
- A number of callback function are added to the converter object.
- The conversion is performed by calling wkhtmltopdf_convert.
- The converter object is destroyed by calling wkhtmltopdf_destroy_converter.

# To image c-bindings

The file image.h contains a fairly high level and stable pure c binding to wkhtmltoimage. These binding are well documented and do not depend on QT. Using this is the recommended way of interfacing with the image portion of libwkhtmltox.

Using these binding it is relatively straight forward to convert one or more HTML document to a raster image or SVG document, using the following process:

- wkhtmltoimage_init is called.
- A wkhtmltoimage_global_settings object is creating by calling wkhtmltoimage_create_global_settings.
- Setting for the conversion are set by multiple calls to wkhtmltoimage_set_global_setting.
- A wkhtmltoimage_converter object is created by calling wkhtmltoimage_create_converter, which consumes the global_settings instance.
- A number of callback function are added to the converter object.
- The conversion is performed by calling wkhtmltoimage_convert.
- The converter object is destroyed by calling wkhtmltoimage_destroy_converter.

# The rest of the headers.

The rest of the headers directly exposes the C++ QT dependent class used internally by wkhtmltopdf and wkhtmltoimage. They are not fairly well documented and are not guaranteed to remain stable. unless you know what you are doing you should not use these bindings.