Recent

Author Topic: [SOLVED] Cannot print HtmlViewer  (Read 738 times)

henschen

  • Newbie
  • Posts: 2
[SOLVED] Cannot print HtmlViewer
« on: January 24, 2020, 09:19:59 am »
I try to print HtmlViewer content to printer without success. This is my code.

Code: Pascal  [Select][+][-]
  1. var
  2.   Prt : TPrinter;
  3. begin
  4.   Prt := Printer;
  5.   Prt.BeginDoc;
  6.   HtmlViewer.Draw(Prt.Canvas, 0, 500, 500, 500);
  7.   Prt.EndDoc;
  8. end;

Found problem in function TGtk2WidgetSet.GetTextMetrics. If fails because IsValidDC returns false.

Code: Pascal  [Select][+][-]
  1. Result := IsValidDC(DC);

Printer is working properly from other software. Please help, thanks!
« Last Edit: January 24, 2020, 11:53:50 am by henschen »

henschen

  • Newbie
  • Posts: 2
Re: Cannot print HtmlViewer
« Reply #1 on: January 24, 2020, 11:53:03 am »
I solved this.

Added a hidden image to my form. Called HtmlViewer.Draw to create image picture. Then copied image to printer with StretchDraw.

 

TinyPortal © 2005-2018