Wx::PdfDocument is a wrapper for the wxPdfDocument wxcode classes for the wxWidgets GUI toolkit. Wx::PdfDocument allows you to create PDF documents directly using Wx::PlPdfDocument methods either directly or in a derivied class. It also provides classes for the wxWidgets printing framework that allow you to print output to a PDF document using any Wx::Printout class. For example, you can print the output of Wx::RichTextPrintout and Wx::HtmlPrintout in addition to any custom Wx::Printout that you may create.

A module is provided in this distribtion for Wx::Demo that gives extensive examples of usage.

For creating PDF documents with your own code, this may be the only class you will need to use. You can either us the class directly or create a derived class and optionally override the following virtual methods.

Footer();
Header();
AcceptPageBreak();

The interface is fully described at the wxPdfDocument documentation site.

As is the normal practice for wxPerl implementations, where the C++ documentation indicates any type of an array parameter, you should pass a reference to a Perl array containing the appropriate types or objects.

A small number of methods cannot be implemented exactly as they are implemented in C++. The wxPerl implementation for these methods is noted below:

This page setup dialog allows you to collect settings for margins, paper type and orientation from the user. It uses the standard Wx::PageSetupDialogData that you can use to determine which of the three settings; margins, paper and orientation, will be available to the user to change.

This print dialog takes the place of the standard printer setup dialog when using the wxWidgets printing framework. It is shown by default when using Wx::PdfPrinter and Wx::PdfPrintPreview and you may also create a dialog yourself to collect user input.

The dialog allows the user to set document properties such as title and subject, choose the output filename and whether to launch the output in a PDF viewer. It also allows setting encryption and document passord options.

You can control which of the options are available to the user by passing a Wx::PdfPrintData object in the constructor with appropropriate settings.

Normally you should collect the options for document protection via the Wx::PdfPrintDialog and let the Wx::PdfPrinter class apply these options for you. To set and apply options directly yourself to a PDF document it is better to call Wx::PdfDocument methods directly.

The following methods of Wx::PdfPrintData are used internally by the Wx::PdfPrinter

If you pass a Wx::PdfPrintData instance to the contructor of a Wx::PdfPrinter, Wx::PdfPrintDialog or Wx::PdfPrintPreview object you can control the printing process and dialog options that will be available to the user

By default, the Wx::PdfPrinter sets up a Wx::PdfDC with a resolution of 600 pixels. perl inch. It does not make any difference to the output quality what you set the resolution to. The PDF format is not pixel based so it is simply a matter of coordinate conversion. However, the Wx::DC drawing functions are integer based and so always introduce rounding and truncation when coordinates are transformed. Therefore, the lower the resolution, the bigger the error you may experience. For example, truncating 600.49 to 600 on a virtual 600 dpi device is a much smaller error that truncating 72.49 to 72 on a virtual 72 dpi device. So you probably don't want to change the resolution defaults.

By default a Wx::PdfDC instance creates a Wx::PdfDocument and outputs the result. The Wx::PdfDC can also operate in 'template mode' where an existing Wx::PdfDocument instance is passed to the constructor. This can be useful to combine the text methods of Wx::PdfDocument with the graphics methods of Wx::PdfDC. In this mode, the StartDoc and EndDoc methods of the Wx::PdfDC have no effect. The Wx::PdfDocument is created outside the Wx::PdfDC instance and code must handle writing it to disk independently too.

To allow template mode to be used within the wxWidgets printing framework (perhaps you have a custom Wx::Printout instance designed to handle enhanced PDF features) you can set the template parameters in a Wx::PdfPrintData instance that gets passed to Wx::PdfPrinter or Wx::PdfPrintPreview.

An interface is provided for calling the makefont and showfont utilities provided with wxPdfDocument. This is necessary to add the wxWidgets and wxPdfDocument libraries in your Perl installation to the appropriate LD_LIBRARY_PATH, DYLD_LIBRARY_PATH and PATH for your operating system and to set the font file location environment variables.

This 0.10 release builds wxPdfDocument 0.9.3 code with minor changes to Windows makefiles to allow building in the Perl / wxPerl environment. All applied patches are in the patches subfolder of the distribution.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12 or, at your option, any later version of Perl 5 you may have available.

The wxPdfDocument C++ class was created by Ulrich Telle <ulrich.telle@gmx.de>