<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 9 lug 2019 alle ore 20:21 Benoît Minisini <<a href="mailto:g4mba5@gmail.com">g4mba5@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi people,<br>
<br>
To add printing feature to the IDE code and text editor, I created a new <br>
component named 'gb.form.print' that provides a generic preview and <br>
printing dialog, and some features to make drawing the page contents a <br>
bit easier.<br>
<br>
1) Instead of calling MyPrinter.Print(), you call MyPrinter.Preview().<br>
<br>
2) You have to implement the Begin, End, Paginate and Print events the <br>
same way as before.<br>
<br>
3) The Paint device is automatically scaled and translated so that width <br>
and height are in 1/10th of millimeters, and represent the printing zone <br>
without the margins.<br>
<br>
For example, a, A4 portrait page with 1 cm margin at each border will <br>
create a paint device whose width is 1900 and height 2770.<br>
<br>
4) Thanks to the new Paint.FontScale property, using a 10 point size <br>
font will always draw a 10 point size font wherever we are drawing: to <br>
the screen, a PDF file, or a printer.<br>
<br>
Beware: at the moment it works only if you *assign* the font to the <br>
Paint.Font property, because this is the only moment the Paint.FontScale <br>
is applied.<br>
<br>
For example :<br>
<br>
hFont = Font["Monospace,10"]<br>
Print hFont.Size ' ==> 10<br>
Paint.FontScale = 2<br>
Paint.Font.Size = hFont<br>
Print Paint.Font.Size ' ==> 20<br>
<br>
This is really a trick at the moment. I had to do that because font size <br>
is supposed to be absolute, but this is really the case only if you use <br>
the font on a screen. Otherwise this can be false. Thanks Microsoft for <br>
that mess.<br>
<br>
5) The GTK components have been fixed so that printing works and behave <br>
the same as with QT components.<br>
<br>
6) The preview dialog is a fork of the 'gb.report2' preview dialog made <br>
by Fabien Bodard. It is based on his DocumentView control that I fixed a <br>
bit by the way.<br>
<br>
7) It's not tested a lot. I even didn't test it on a real printer yet!<br>
<br>
Please report any problem and ask questions if needed, as usual.<br>
<br>
Regards,<br>
<br>
-- <br>
Benoît Minisini<br></blockquote><div><br></div><div>Hi Benoit,</div><div><br></div><div>Print only on paper or I do something wrong?</div><div><br></div><div>Regards</div><div>Gianluigi<br> </div></div></div>