[Qt] Printing with WebKit

Den Jean Den.Jean at telenet.be
Thu Sep 24 18:58:43 CEST 2009


On Friday 18 September  2009 16:52:09 aime two wrote:
> Is someone has an idea about my problem when I try print with Qwebview
> on Windows?
I tested on windows and linux and it just works. 

test code (lacks some *_destroys, just for testing purposes) 

try
  PrnInfo:=QPrinterInfo_Create;
  QPrinterInfo_DefaultPrinter(PrnInfo);

  if QPrinterInfo_isNull(PrnInfo) then
    begin
    writeln('no printer found');
    exit;
    end;

  Prn:=QPrinter_Create(PrnInfo);
  QPrinterInfo_printerName(PrnInfo, at w);
  writeln('Default Printer Name:',w);
  PrintDlg:=QPrintDialog_create(Prn);
  QPrintDialog_exec(PrintDlg);
  QPrinter_printerName(QAbstractPrintDialog_printer(PrintDlg), at w);
  writeln('Chosen Printer Name:',w);

  QWebView_print(ActiveTab.WebView,QAbstractPrintDialog_printer(PrintDlg));

except on E:Exception do
  writeln('Exception occurred in FilePrint:',E.Message);
end;




More information about the Qt mailing list