How to get printable area of the page

F

fujing1003

Sub GetPrintInfo()
Dim lWidth As Long
Dim lHeight As Long
Dim PrinterName As String
Dim PrinterHandle As Long
Dim PrintInfo As PRINTER_DEFAULTS

PrinterName = GetDefaultPrinterName
OpenPrinter PrinterName, PrinterHandle, PrintInfo
lWidth = GetDeviceCaps(PrinterHandle, 8)
lHeight = GetDeviceCaps(PrinterHandle, 10)
MsgBox "Width=" & lWidth & vbCrLf & "Height=" & lHeight
End Sub

use the above sub to get printable area of the page, I've already get
the PrinterHandle,but failed to get lWidth and lHeight .

According to
http://msdn2.microsoft.com/en-us/library/ms533266.aspx
"Do not call this method to get printer capabilities from an XPSDrv
driver. Instead, use the DrvDeviceCapabilities function"

so I try to use DrvDeviceCapabilities instead of GetDeviceCaps, but
can't know which library it is in. the msdn don't tell this.
http://msdn2.microsoft.com/en-us/library/bb734109.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top