HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF THE CURRENT PAPER SIZE

  • Thread starter Thread starter **Developer**
  • Start date Start date
D

**Developer**

THIS IS WHAT I DO:

Dim lG As Graphics = pD.PrinterSettings.CreateMeasurementGraphics()

Dim lHdc As IntPtr = lG.GetHdc()

leftOffsetP = GetDeviceCaps(lHdc, PHYSICALOFFSETX)

topOffsetP = GetDeviceCaps(lHdc, PHYSICALOFFSETY)

printableWidthP = GetDeviceCaps(lHdc, HORZRES) 'Width in pixels,

printableHeightP = GetDeviceCaps(lHdc, VERTRES) 'Height in raster lines

lG.ReleaseHdc(lHdc)

lG.Dispose()

THIS IS WHAT I THINK:

lG, as define above, also maintains the default settings

pD.PrinterSettings.DefaultPageSettings maintains the default settings

pD.DefaultPageSettings tracks the current settings

That is, if the app changes the paper size, for example, the latter one

shows the change while the first two do not.

IS THAT RIGHT?

HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF
THE CURRENT PAPER SIZE??



Thanks for any help
 
**Developer** said:
Dim lG As Graphics = pD.PrinterSettings.CreateMeasurementGraphics()

Dim lHdc As IntPtr = lG.GetHdc()

leftOffsetP = GetDeviceCaps(lHdc, PHYSICALOFFSETX)

topOffsetP = GetDeviceCaps(lHdc, PHYSICALOFFSETY)

This will return the /physical/ margins.
HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF
THE CURRENT PAPER SIZE??

Use 'PageSettings.Margins' to determine the margins set by the user.
 
I wasn't clear. What I need is the minimum right and bottom margins. That
is, the ones set by the printer.
Given the left and top minimums, the paper size and the printable dimensions
set by the printer, I can figure the printer imposed minimum right and
bottom margins.

Thanks
 

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

Back
Top