PrinterPageHorDPI() e PrinterPageVerDPI()

Share your advanced PureBasic knowledge/code with the community.
Alberto
User
User
Posts: 25
Joined: Mon May 19, 2003 4:59 pm

PrinterPageHorDPI() e PrinterPageVerDPI()

Post 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
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

I had this one in my todo list ... you got it.

Thanks for sharing this.

Krgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
Post Reply