Board index » delphi » Use printer.canvas without printer.beginDoc ?

Use printer.canvas without printer.beginDoc ?

Hello,

 In a program, I would like to calculate the number of pages necessary
to print a document.

To do this, I use canvas.textWidth but the result is false if I don't
do before 'printer.beginDoc'.

But I don't want to use printer.beginDoc because if I abort printing
after I have calculated page number,  the printer waste a page of
paper, even if I print nothing.

Thank you for your answers.

Alexandre Boisram
Paris - FRANCE
abois...@club-internet.fr

 

Re:Use printer.canvas without printer.beginDoc ?


I had the same problem and couldn't find a ready answer.

So, I used the GetTextExtentPoint(hDC,...) function (See Win32.hlp) and
passed in the Printer.Canvas.Handle.

Other Threads