-
May 30th, 2000, 02:34 AM
#1
Printer Margins
How do I get the minimum printer margins? I need to position a label on a page. The user enters the X,Y coordinates of the upper left corner. In order to position this correctly, I need to subtract the printer margins.
-
June 4th, 2000, 06:01 PM
#2
Re: Printer Margins
Look at the GetDeviceCaps function.
PHYSICALOFFSETX
PHYSICALOFFSETY
PHYSICALWIDTH
and PHYSICALHEIGHT values for nIndex.
Dave McLelland
D. McLelland (Software) Limited
Dave Mclelland.
-
October 15th, 2009, 04:57 AM
#3
Re: Printer Margins
Good Day,
by using the PHYSICALOFFSETX and PHYSICALOFFSETY i get the "the distance from the left/top edge of the physical page to the left/top edge of the printable area" as noted in MSDN help.
My question is: how can i find the "right" and "bottom" offsets? Are these the same as their left/top counterparts?
This would not be an issue if PHYSICALWIDTH and PHYSICALHEIGHT returned the width/height bounds for the printer rather than the page size...
Thanx in advance,
Stakon.
-
October 15th, 2009, 05:29 AM
#4
Re: Printer Margins
Originally Posted by stakon
This would not be an issue if PHYSICALWIDTH and PHYSICALHEIGHT returned the width/height bounds for the printer rather than the page size...
The issue is... These values ARE dependant on paper size.
The printer I'm using at home can print A4 paper up to 4mm from the bottom. But when printing envelopes, it can only handle 12mm from the bottom
You cannot assume the bottom and right edges of what the printer can handle are universal across all papersizes the printer can handle.
-
October 15th, 2009, 06:13 AM
#5
Re: Printer Margins
OReubens,
I am aware of what you are explaining here. Perhaps the way i wrote the above is confusing...
What i mean is that PHYSICALWIDTH and PHYSICALHEIGHT return the actual physical paper size
as explained in http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
And what i am asking is:
Can i safely assume that the value returned from PHYSICALOFFSETX (which describes the left printer margin), can be also used as the right printer margin?
for example:
left_margin = GetDeviceCaps(PHYSICALOFFSETX);//This IS correct
right_margin = GetDeviceCaps(PHYSICALWIDTH) - left_margin; //??? is THIS correct ???
-
October 15th, 2009, 06:37 AM
#6
Re: Printer Margins
Originally Posted by stakon
right_margin = GetDeviceCaps(PHYSICALWIDTH) - left_margin; //??? is THIS correct ???
No, it isn't correct.
"GetDeviceCaps(PHYSICALWIDTH) - left_margin" gives you the sum of the printable area's width and the right margin.
-
October 15th, 2009, 06:41 AM
#7
Re: Printer Margins
HORZRES will give you the width of the printable area
VERTRES will give you the height of the printable area.
-
October 15th, 2009, 06:42 AM
#8
Re: Printer Margins
Left/Right margins don't need to be identical (although they usually are)
Bottom and top margins don't need to be identical (and they rarely are).
-
October 15th, 2009, 06:53 AM
#9
Re: Printer Margins
Nikitozz,
i think you are confusing something.
Let me explain with a numerical example:
left_margin = GetDeviceCaps(PHYSICALOFFSETX); // = 80 //assume left margin is 80
page_width = GetDeviceCaps(PHYSICALWIDTH); // = 5000 //assume physical page width is 5000
right_margin = page_width - left_margin; //5000 - 80 = 4920
So the result is the right_margin's position is 4920 units from the left of the physical page which is what i am looking for.
Thanx OReubens for pointing out these (HORZRES ,VERTRES)
Last edited by stakon; October 15th, 2009 at 06:56 AM.
-
October 15th, 2009, 08:03 AM
#10
Re: Printer Margins
Originally Posted by stakon
So the result is the right_margin's position is 4920 units from the left of the physical page which is what i am looking for.
Ok. It's clear now. I haven't understand you.
I thought you wanted to find out the "width" of the margin.
-
October 15th, 2009, 08:22 AM
#11
Re: Printer Margins
This post was from June 2000!
I hope the thread starter got it solved by now
-
October 15th, 2009, 11:12 AM
#12
Re: Printer Margins
Originally Posted by stakon
right_margin = page_width - left_margin; //5000 - 80 = 4920
So the result is the right_margin's position is 4920 units from the left of the physical page which is what i am looking for.
No, because the right margin and left margin are not necessarily the same.
Left margin is at PHYSICALOFFSETX
right margin is at PHYSICALOFFSETX + HORZRES
the width of the right margin is PHYSICALWIDTH - (PHYSICALOFFSETX + HORZRES)
-
October 15th, 2009, 11:14 AM
#13
Re: Printer Margins
Originally Posted by jnmacd
This post was from June 2000!
I hope the thread starter got it solved by now
Maybe, but someone else (stakon) picked up on it since he has an issue with this also. He SHOULD have made a new thread for this though
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|