Page 1 of 1

PrinterPageHorDPI() e PrinterPageVerDPI()

Posted: Fri Jun 25, 2004 8:54 am
by Alberto
Code updated for 5.20+

Hallo,

this is a very simple code with which is possible to create the important functions PrinterPageHorDPI() e PrinterPageVerDPI() to know the DPI resolution of a printer.


Code: Select all

If PrintRequester() 
   printer_DC.l = StartDrawing(PrinterOutput())
    If  printer_DC
        Debug "Horizontal DPI = " + Str(GetDeviceCaps_(printer_DC,#LOGPIXELSX))
        Debug "Vertical DPI = " + Str(GetDeviceCaps_(printer_DC,#LOGPIXELSY))
        Debug "Physical Width in pixels = " + Str(GetDeviceCaps_(printer_DC,#PHYSICALWIDTH)) 
        Debug "Physical Height in pixels = " + Str(GetDeviceCaps_(printer_DC,#PHYSICALHEIGHT)) 
        Debug "Horizontal margin in pixels = " + Str(GetDeviceCaps_(printer_DC,#PHYSICALOFFSETX)) 
        Debug "Vertical margin in pixels = " + Str(GetDeviceCaps_(printer_DC,#PHYSICALOFFSETY)) 
        Debug "Width in pixels (same as PrinterPageWidth())= " + Str(GetDeviceCaps_(printer_DC,#HORZRES))
        Debug "Height in pixels (same as PrinterPageHeight())= " + Str(GetDeviceCaps_(printer_DC,#VERTRES))
        Debug "PriterPageWidth() = " + Str(PrinterPageWidth())
        Debug "PrinterPageHeight() = " + Str(PrinterPageHeight())
        Debug "Width in millimiter (same as Width in pixels * 25.4 / DPI) = " + Str(GetDeviceCaps_(printer_DC,#HORZSIZE))
        Debug "Height in millimiter (same as Height in pixels * 25.4 / DPI)= " + Str(GetDeviceCaps_(printer_DC,#VERTSIZE))
    EndIf
    StopDrawing()
EndIf
End
Ciao a tutti
---------------
Alberto

Posted: Fri Jun 25, 2004 9:32 am
by fweil
I had this one in my todo list ... you got it.

Thanks for sharing this.

Krgrds