473,395 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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



Nov 21 '05 #1
2 1283
" **Developer**" <RE*************@a-znet.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
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]" <hi***************@gmx.at> wrote in message
news:eT****************@TK2MSFTNGP10.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
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.

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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Will McGugan | last post by:
Hi, I'm writing an app that downloads images. It rejects images that are under a certain size - whithout downloading them completely. I've implemented this using PIL, by downloading the first K...
5
by: Peter Chant | last post by:
Any thoughts in the newsgroup? Over Christmas I produced, using PHP and MySQL, a database and front end to record my familys family tree with a short biography and linked photos and locations if...
2
by: Adam Teale | last post by:
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this:...
10
by: Alan M Dunsmuir | last post by:
Is there a standard technique, in a PHP/MySQL Web Application, for users to be provided with printable-quality output - e.g. business invoices - created for them on the fly?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.