Getting paper margins before printing
Getting paper margins before printing
- Subject: Getting paper margins before printing
- From: jean Bousquet <email@hidden>
- Date: Fri, 13 Sep 2002 22:32:35 +0200
I try to get paper margins (left, right, top, bottom) before preparing to
print. I coded this way :
-(void)paperInfos
{
NSPageLayout *aPageLayout=[NSPageLayout pageLayout];
NSPrintInfo *pi;
// display the Page SetUp panel to choice paper and printer
if ([aPageLayout runModal]==NSCancelButton) return;
// Now the receiver's values are recorded in the shared NSPrintInfo
object (Apple says)
pi=[NSPrintInfo sharedPrintInfo];
NSLog(@" w= %f, h=%f, l=%f, r=%f, t=%f, b=%f",
[pi paperSize].width,[pi paperSize].height,
[pi leftMargin], [pi rightMargin],
[pi topMargin], [pi bottomMargin]);
I expected to get the same values for paper size and paper margins as these
displayed in the PageSetUp panel by choosing "Summary".
The paper size is the same but the margins are not ??
Here what I get from NSLog
w= 595.000000, h=842.000000, l=72.000000, r=72.000000, t=90.000000,
b=90.000000
and now what I read on the Summary in the Page SetUp panel (converted to
points)
width=595 (same)
height=842 (same)
left=27 (compare to 72 in NSLog)
right=24 (compare to 72 in NSLog)
top=31 (compare to 90 in NSLog)
bottom=31 (compare to 90 in NSLog)
The figures displayed in the Summary of the Page SetUp panel are the right
one, the sharedPrintInfo is not correct.
Did any body experience the same thing or could help me to point what I did
wrong ?
I use Mac OS X version 10.1
Many thanks for your help.
Jean
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.