Hi People,

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

There is a wxPdfDocument structure in wxWidgets, but it is unwrapped, so I
thought it would be easier to use the 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 of email.

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"); 

  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".

<<Blank Bkgrd.gif>>

Reply via email to