Page 1 of 1

Bullets print wrong with SRichViewEdit.DrawPage

Posted: Mon Oct 22, 2012 4:36 pm
by juan_lb
I'm using the method TSRichViewEdit.DrawPage to get my text printed.

I'm using that method beacause I need to print the background.
The problem is that all the bullets get printed too large and out of place.

The text and the background are just fine.

I really don't understand what migth be the problem.

Do you know the cause of this behavior?

Thanks in advance.

Juan.

Posted: Mon Oct 22, 2012 5:41 pm
by Sergey Tkachenko
Please send me a sample project reproducing this problem

Posted: Tue Oct 23, 2012 12:50 pm
by Sergey Tkachenko
Unfortunately, you cannot call DrawPage for Printer.Canvas.
This method needs to change Canvas.Font.PixelsPerInch temporarily, but TPrinterCanvas does not allow to do it.

A workaround:
1. Declare

Code: Select all

var   PageCanvas: TCanvas;
2. In the beginning, after Printer.BeginDoc:

Code: Select all

  PageCanvas := TCanvas.Create;
  PageCanvas.Handle := Printer.Canvas.Handle;
In the call of
3. In the calls of DrawPage, change Printer.Canvas to PageCanvas
4. In the end:

Code: Select all

  PageCanvas.Handle := 0;
  PageCanvas.Free;

Posted: Tue Oct 23, 2012 1:55 pm
by juan_lb
It works!!

Thank you :D