What is wxPdfDocument?
wxPdfDocument is a C++ class which allows wxWidgets applications to generate PDF files. The code is a port of FPDF - a free PHP class for generating PDF files - to C++ using the wxWidgets library. wxPdfDocument does not make use of any libraries like PDFlib or ClibPDF which require a fee at least for commercial usage. wxPdfDocument is published under the wxWidgets (formerly wxWindows) license. This means you may use it for any kind of usage and modify it to suit your needs.
wxPdfDocument offers all advantages of FPDF. Several add-on PHP scripts found on the FPDF web site are incorporated into wxPdfDocument. The main features are:
- Choice of measure unit, page format and margins
- Page header and footer management
- Automatic page break
- Automatic line break and text justification
- Image support (GIF, JPEG, PNG and WMF)
- Colors (Grayscale, RGB, CMYK, Spot colors)
- Links (internal and external)
- 14 Adobe standard fonts
- TrueType and Type1 fonts (with or without embedding) and encoding support
- TrueType Unicode and Type0 fonts (for Chinese, Japanese and Korean) support in the Unicode build
- Page compression
- Graphics primitives for the creation of simple drawings
- Definition of clipping areas
- Bookmarks for outlining the document
- Protecting the document by passwords and/or access permissions
- Text annotations
- PDF forms (supported field types: text, combo box, check box, radio button, push button)
- Fill gradients
The class can produce documents in many languages other than the Western European ones: Central European, Cyrillic, Greek, Baltic and Thai, provided you own TrueType or Type1 fonts with the desired character set. In the Unicode build Chinese, Japanese and Korean are supported, too.
A Reference Manual showing all available methods in alphabetical order is provided. A sample application including more than 20 examples demonstrates the different features. A separate detailed description is available for the MakeFont Utility. The chapter Styling text using a simple markup language describes the supported tags of the simple XML markup language used by the method wxPdfDocument::WriteXml.
wxPdfDocument is hosted as a component of wxCode. For any remark, question or problem, you can leave a message on the appropriate wxCode tracker accessible from the wxCode support page. Or you can send a mail to me directly.
- Although all features were thoroughly tested individually, not all possible combinations were verified to function properly. This means: wxPdfDocument still needs intensive testing. If you find bugs please report them to the author!
- 0.8.0 - December 2006
- support for external templates: pages of existing PDF documents may be imported and used as templates
- font subsetting for TrueType and TrueType Unicode fonts, often resulting in much smaller PDF file sizes
- support for using and embedding OpenType Unicode fonts
- enhanced support for password based encryption, encryption key length freely definable between 40 and 128 bits (Attention: Adobe Reader supports only keys with 40 or 128 bits.)
- support for AES encryption (additional standard encryption method in PDF version 1.6 and above)
wxPdfDocument is compatible with wxWidgets version 2.8.0 as well as with version 2.6.x.
As an add-on preprocessed font files for the free DejaVu fonts (version 2.12) are provided in the file release wxPdfDocument Add-Ons.
Attention: For supporting font subsetting for ordinary non-Unicode TrueType fonts the format of the font definition files has been extended. Font definition files created with prior versions of the MakeFont Utility are still usable, but do not support font subsetting. It is recommended to regenerate own font definition files. Unfortunately common AFM font metric files do not contain glyph information which is required by the MakeFont Utility to create the character-to-glyph mapping. Therefore the utility
ttf2ufm had to be changed. The modified version including a Windows executable is available in the file release wxPdfDocument Add-Ons.
- 0.7.6 - October 2006
Added features (thanks to Stuart Smith):
- setting/getting the default path used for loading font files
- getting the description of the current font
- loading images from a wxInputStream (in addition to loading from file or wxImage)
Attention: The structure of the font definition files has changed due to the addition of the font attribute
xHeight. It is necessary to regenerate own font definition files using the MakeFont Utility. To support the
xHeight attribute the utility
ttf2ufm had to be changed.
wxPdfDocument is now compatible with wxWidgets version 2.7.1 and above as well as with version 2.6.x.
Fixed several bugs
- 0.7.5 - September 2006
Added or enhanced features:
- support for tables in simple XML markup spanning more than a page
- support for internal links in simple XML markup
- support for transparency
- support for image masks
- support for internal templates
- support for polygon and shape clipping
- support for printing text along a path
- extended support for fill gradients (API changed!)
- internal color management reworked
Fixed some minor bugs
- 0.7 - April 2006
- support for CMYK and spot colors
- support for named colors (486 predefined names for RGB colors) (wxPdfColour)
- support for color names in HTML notation (#rrggbb) (wxPdfColour)
- text annotations
- additional font decorations: overline, strikeout
- PDF forms
- Simple XML markup language for styling and structuring text
Added or modified methods:
- 0.6 - November 2005
Changed API of graphics primitives: line style and fill color parameters deleted, line style and fill color have to be set using wxPdfDocument::SetLineStyle and wxPdfDocument::SetFillColor.
- 0.5 - September 2005
First public release
- 0.4 - August 2005
Support for embedding fonts
- 0.3 - July 2005
Support for embedding images
- 0.2 - June 2005
Several add-ons implemented
- 0.1 - May 2005
- Planning and basic PDF features implemented
- Ulrich Telle (ulrich DOT telle AT gmx DOT de)
Since wxPdfDocument is based on the great FPDF PHP class and several of the contributions to it found on the FPDF website I would like to thank
- Olivier Plathey (FPDF, Barcodes, Bookmarks, Rotation),
- Maxime Delorme (Sector)
- Martin Hall-May (WMF images, Transparency)
- Emmanuel Havet (Code39 barcodes)
- Shailesh Humbad (POSTNET barcodes)
- Matthias Lau (i25 barcodes)
- Pierre Marletta (Diagrams)
- Laurent Passebecq (Labels)
- David Hernandez Sanz (additional graphics primitives)
- Valentin Schmidt (Transparency, Alpha channel)
- Jan Slabon (FPDI)
- Klemen Vodopivec (Protection)
- Moritz Wagner (Transformation)
- Andreas Wuermser (Clipping, Gradients, Transformation)
The wxPdfDocument encryption methods use the RSA Data Security, Inc. MD5 Message Digest Algorithm (RSA Data Security license) and the Rijndael cipher implementation of Szymon Stefanek (Public Domain). For detailed license information
- See also:
- files pdfencrypt.cpp and pdfrijndael.h.