[Lazarus] Printer margins
Jesus Reyes
jesusrmx at yahoo.com.mx
Wed May 28 00:50:53 CEST 2008
--- Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com>
escribió:
> Hello,
>
> Printing to the 0,0 position in the canvas from the Printer seams
> to
> print nothing, until the margin is reached (Mac OS X), so I did a
> small research to find out which top/left margin to use, but it
> seams
> that it's not implemented in LCL.
>
> Searching for Delphi, people seam to use this:
>
> GetDeviceCaps( printer.handle, LOGPIXELSX );
>
> Top Margin: PHYSICALOFFSETY
> Left Margin: PHYSICALOFFSETX
> Right Margin: ((PHYSICALWIDTH) - (PHYSICALOFFSETX + HORZRES)) div
> LOGPIXELSX
> Bottom Margin: ((PHYSICALHEIGHT) - (PHYSICALOFFSETY + VERTRES)) div
> LOGPIXELSY
>
> Alternatively we can also use PageWidth and PageHeight to get how
> much
> we can draw in the paper, but this doesn't help with the left/top
> offset.
>
> PHYSICALOFFSETX doesn't exist in LCL, so I think it isn't
> implemented
> for GetDeviceCaps.
>
> What do people currently use to print?
>
> Also, this winapi method is rather clumsy, maybe we should add some
> margin properties to TPrinter, what do you think?
>
> thanks,
> --
> Felipe Monteiro de Carvalho
This is already done, see components/printers/win32/winprinter.inc
for windows.
Basically you set the wished (existing) paper name using:
printer.papersize.papername := 'papername'; then you have
printer.papersize.physicalrect and printer.papersize.workrect to work
with, see also lazreport/source/lr_prntr.pas code
Jesus Reyes A.
____________________________________________________________________________________
Yahoo! Deportes Beta
¡No te pierdas lo último sobre el torneo clausura 2008! Entérate aquí http://deportes.yahoo.com
More information about the Lazarus
mailing list