Hi People,

I am using the Wx::RichText framework, which is more or less doing what I want from it, however, I'd like to create a PDF file from my RichTextBuffer.

There is a wxPdfDocument structure in wxWidgets, but it is unwrapped, so I thought it would be easier to use the Wx print framework instead.

The issue is that if I call the print dialogue everything works fine, and I can create a PDF with no problem, however (as I want it to be transparent to the user), when I do it bypassing the print dialogue, it doesn't work.

Code follows at end.

My question is:

  1. does anyone have background (or at least dialogue-less) printing working for any printer type?
  2. does anyone have an alternative method for creating PDFs from wxXML objects? Or anything else?
  3. am I using the print framework commands properly?

As always, many thanks for your ideas.

Regards

Steve

my $loc_pdf_printdata = $self->{Ctl_RTC_Printing_Obj}->GetPrintData; $loc_pdf_printdata->SetOrientation( wxPORTRAIT ); $loc_pdf_printdata->SetNoCopies(1); $loc_pdf_printdata->SetPaperId( wxPAPER_A4 ); $loc_pdf_printdata->SetPrinterName("Virtual_PDF_Printer"); # This i +s the name of the Printer as it appears in cups on localhost:631. my $loc_printdialogdata = Wx::PrintDialogData->new(); $loc_printdialogdata->SetPrintData($loc_pdf_printdata); my $loc_pdf_printout = Wx::Printout->new("PDF Report"); my $loc_wxPrinter = Wx::Printer->new($loc_printdialogdata); my $loc_success = $loc_wxPrinter->Print( undef, $loc_pdf_printout, 0 + ); print $loc_success.";

# Print $loc_success returns "1".


In reply to Wx::Perl, background printing, PDF document creation and PDF file names. by Steve_BZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.