Steve_BZ has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys,

So all the suppressing of the Wx::PrintDialog box was about trying to print my Wx::RichText doc in background to a PDF file. (See Wx::Perl, background printing, PDF document creation and PDF file names.) I never got it working despite spending a week on it.

The options I have explored are:

  1. Print in background to PDF printer, but the printer does not work without the dialogue box.
  2. wxRichTextCtrl::SaveFile with wxRICHTEXT_TYPE_PDF, but apparently wxRICHTEXT_TYPE_PDF is not yet implemented.
  3. External packages like Wx::PdfDocument, but a) The wrapping is very old, for an out-of-date version, and would need to be updated and b) it would require me to implement a per-page PrinterDC style of printing.

At the moment the last seems the most attractive, but are there any others I haven't considered?

The XML, I understand is a custom XML, so although there are plenty of XML2PDF style packages around, I guess they won't work for the Wx brand of XML, is that right?

Any ideas? Maybe I'm missing something very obvious.

Regards

Steve

Replies are listed 'Best First'.
Re: How to save Wx::XML docs as PDF.
by Steve_BZ (Chaplain) on Mar 22, 2012 at 20:42 UTC

    So following on from option 3), I find I can download the version with about the date on Wx::PdfDocument with:

    wget http://ufpr.dl.sourceforge.net/project/wxcode/Components/wxPdfDoc +ument/wxpdfdoc-0.7.5.tar.gz tar -zxvf wxpdfdoc-0.7.5.tar.gz cd wxpdfdoc export PATH=/usr/local/lib/perl/5.10.1/Alien/wxWidgets/gtk_2_8_11_uni/ +bin:$PATH export LD_LIBRARY_PATH=/usr/local/lib/perl/5.10.1/Alien/wxWidgets/gtk_ +2_8_11_uni/lib:$LD_LIBRARY_PATH ./configure make make install cd ~

    On the way I get a few compile errors like this:

    ././src/pdfimage.cpp:580: error: ‘class wxGIFDecoder’ has no member na +med ‘ReadGIF’ ././src/pdfimage.cpp:587: error: ‘class wxGIFDecoder’ has no member na +med ‘GetWidth’ ././src/pdfimage.cpp:588: error: ‘class wxGIFDecoder’ has no member na +med ‘GetHeight’

    As I have no intention of using GIFs I comment out the offending code.

    And miraculously I get a clean compile.

    I already have Wx 2.8.11 (as you can see). So now I do a cpan install and this is the resulting dump:

    Maybe it's because wxWidgets is a relatively new version and Wx::PdfDocuments is relatively 'Mature'.

    What do you think?

    Regards

    Steve

      What do you think?

      Look inside, start resolving the perl errors first, like the thing about Wx/XSP/Driver.pm, then try again