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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • **Developer**

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

    THIS IS WHAT I DO:

    Dim lG As Graphics = pD.PrinterSetti ngs.CreateMeasu rementGraphics( )

    Dim lHdc As IntPtr = lG.GetHdc()

    leftOffsetP = GetDeviceCaps(l Hdc, PHYSICALOFFSETX )

    topOffsetP = GetDeviceCaps(l Hdc, PHYSICALOFFSETY )

    printableWidthP = GetDeviceCaps(l Hdc, HORZRES) 'Width in pixels,

    printableHeight P = GetDeviceCaps(l Hdc, VERTRES) 'Height in raster lines

    lG.ReleaseHdc(l Hdc)

    lG.Dispose()

    THIS IS WHAT I THINK:

    lG, as define above, also maintains the default settings

    pD.PrinterSetti ngs.DefaultPage Settings maintains the default settings

    pD.DefaultPageS ettings 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







  • Herfried K. Wagner [MVP]

    #2
    Re: HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF THE CURRENT PAPER SIZE

    " **Developer**" <REMOVEdevelope r@a-znet.com> schrieb:[color=blue]
    > Dim lG As Graphics = pD.PrinterSetti ngs.CreateMeasu rementGraphics( )
    >
    > Dim lHdc As IntPtr = lG.GetHdc()
    >
    > leftOffsetP = GetDeviceCaps(l Hdc, PHYSICALOFFSETX )
    >
    > topOffsetP = GetDeviceCaps(l Hdc, PHYSICALOFFSETY )[/color]

    This will return the /physical/ margins.
    [color=blue]
    > HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF
    > THE CURRENT PAPER SIZE??[/color]

    Use 'PageSettings.M argins' to determine the margins set by the user.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • **Developer**

      #3
      Re: HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF THE CURRENT PAPER SIZE

      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

      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
      news:eTAhM%23u1 FHA.1568@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      >" **Developer**" <REMOVEdevelope r@a-znet.com> schrieb:[color=green]
      >> Dim lG As Graphics = pD.PrinterSetti ngs.CreateMeasu rementGraphics( )
      >>
      >> Dim lHdc As IntPtr = lG.GetHdc()
      >>
      >> leftOffsetP = GetDeviceCaps(l Hdc, PHYSICALOFFSETX )
      >>
      >> topOffsetP = GetDeviceCaps(l Hdc, PHYSICALOFFSETY )[/color]
      >
      > This will return the /physical/ margins.
      >[color=green]
      >> HOW CAN I OBTAIN THE PRINTABLE DIMENSIONS OF
      >> THE CURRENT PAPER SIZE??[/color]
      >
      > Use 'PageSettings.M argins' to determine the margins set by the user.
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://classicvb.org/petition/>[/color]


      Comment

      Working...