[Solved] Controling text size to virtual printer lazarus / 39-Graphics ---------------------------------------------------------------------- emaza · 2014-07-10 00:50 Hi. I hope this is the right topic group. I am using Printer.Canvas.TextOut to print reports from my program. All initial problems when changing fonts etc solved after some research by using Abs(2* Printer.Canvas.Font.Height) for space between print lines, and a factor of Round(Printer.PageWidth/215) to set the aprox horizontal position in millimeters –limiting printing to 8.5 inch wide paper- which is ok with me for now. I am still using Windows XP, and programming either the PrintDialog or PrinterSetupDialog (see no dif between these) the user can select a real printer or two virtual options to print to file: Microsoft Office Document Image Writer OR Microsoft XPS Document Writer. With the options mentioned above all three options work fine. The problem is this: If after printing a document the user changes from, or to, the virtual Image (TIF) printer, the text size is altered in the second document. Result is then either an extremely small text in the XPS report (everything else, including column positions ok) or extremely large text on the TIF report. Closing the program and running again resets printing for as long as the printer is not changed again. No idea if any of this would work if ported to Lynux. Seems to me (no expert) that there should be some command that could be placed after printing or before printing to avoid this, but after a week of searching learned a lot about “Scaling”, DPI Aware applications, etc, but found no solution I could implement. Will appreciate help. ---------------------------------------------------------------------- marcov · 2014-07-10 07:41 IIRC query the virtual printer size for DPI settings, and adjust using them.  It has been over 10 years that I did this at a previous employer's, so I don't have code. ---------------------------------------------------------------------- emaza · 2014-07-10 20:46 Thanks Marcov. Very unsure about what data to query, how to query, and how to adjust, so was looking for some way to make windows automatically do it again as it does on the first loop. Had tried some code using “Printer.Canvas.Font.PixelsPerInch” and “Printer.XDPI” which did not work. After reading your advice I tried this: If Printer.PrinterName='Microsoft Office Document Image Writer' then Printer.Canvas.Font.Height := -22; If Printer.PrinterName='Microsoft XPS Document Writer' then Printer.Canvas.Font.Height := -67; This to my surprise worked. It is an ugly temporary solution which probably only works for the Font I have set, but good for me now, to improve later. Thanks very much for pointing me in the right path. I will mark this as solved, although all further answers are welcome. PS: I had to google “IIRC” to find what it meant. I thought it was a type of Pascal Query!  Thanks again.