More Info. If I do this:

- (void)        setPrintInfo:(NSPrintInfo*) printInfo
{
        [super setPrintInfo:printInfo];
        
        PMPageFormat    pmf = (PMPageFormat)[printInfo PMPageFormat];
        PMPaper         paper;
        OSStatus        err = PMGetPageFormatPaper( pmf, &paper );
        
        if( err == noErr )
        {
                PMPaperMargins margins;
                err = PMPaperGetMargins( paper, &margins );
                
NSLog(@"paper margins = {%f, %f} - {%f, %f}", margins.top, margins.left, margins.bottom, margins.right );
        }
}


I get the expected values logged. This suggests to me that the - xxxMargin methods of NSPrintInfo are in fact, broken. If that's the case I'll gladly report it, but I'd like to hear from anybody who knows this stuff if my expectations are correct here.

--Graham





On 09/07/2009, at 2:48 PM, Graham Cox wrote:

I'm trying to get information about printing margins so my app can show where the edges of the paper are correctly as well as the content area.

I thought that's what NSPrintInfo methods such as -topMargin gave me - the margins set by the Page Setup... dialog. But they never change no matter what I do in the Page Setup dialog. The value of NSPaperSize is also the same. I read the Printing Guide but it doesn't mention margins at all.

Here are two examples, logged from the -setPrintInfo: method of NSDocument. The first paper is a custom size based on A4 with margins set to 0, the second set to 3 cm. As can be seen, apart from the paper name, the info is identical.

2009-07-09 14:31:45.310 Ortelius[16094:10b] set print info: {
   NSBottomMargin = 90;
   NSCopies = 1;
   NSDetailedErrorReporting = 0;
   NSFaxNumber = "";
   NSFirstPage = 1;
   NSHorizonalPagination = 2;
   NSHorizontallyCentered = 1;
   NSJobDisposition = NSPrintSpoolJob;
   NSLastPage = 2147483647;
   NSLeftMargin = 72;
   NSMustCollate = 1;
   NSOrientation = 0;
   NSPagesAcross = 1;
   NSPagesDown = 1;
   NSPaperName = "A4 Minimal Margins 1";
   NSPaperSize = NSSize: {651.969, 935.433};
   NSPrintAllPages = 1;
   NSPrintProtected = 0;
   NSPrintTime = 0001-01-01 10:00:00 +1000;
   NSPrinter = {
   "Device Description" =     {
       NSDeviceIsPrinter = YES;
   };
   "Language Level" = 3;
   Name = "Canon i550";
   Type = "Canon i550";
};
   NSPrinterName = "Canon i550";
   NSRightMargin = 72;
   NSSavePath = "";
   NSScalingFactor = 1;
   NSTopMargin = 90;
   NSVerticalPagination = 0;
   NSVerticallyCentered = 1;
}

2009-07-09 14:32:01.407 Ortelius[16094:10b] set print info: {
   NSBottomMargin = 90;
   NSCopies = 1;
   NSDetailedErrorReporting = 0;
   NSFaxNumber = "";
   NSFirstPage = 1;
   NSHorizonalPagination = 2;
   NSHorizontallyCentered = 1;
   NSJobDisposition = NSPrintSpoolJob;
   NSLastPage = 2147483647;
   NSLeftMargin = 72;
   NSMustCollate = 1;
   NSOrientation = 0;
   NSPagesAcross = 1;
   NSPagesDown = 1;
   NSPaperName = "A4 Big Margins";
   NSPaperSize = NSSize: {651.969, 935.433};
   NSPrintAllPages = 1;
   NSPrintProtected = 0;
   NSPrintTime = 0001-01-01 10:00:00 +1000;
   NSPrinter = {
   "Device Description" =     {
       NSDeviceIsPrinter = YES;
   };
   "Language Level" = 3;
   Name = "Canon i550";
   Type = "Canon i550";
};
   NSPrinterName = "Canon i550";
   NSRightMargin = 72;
   NSSavePath = "";
   NSScalingFactor = 1;
   NSTopMargin = 90;
   NSVerticalPagination = 0;
   NSVerticallyCentered = 1;
}


So how can I get the information I need - the size of each margin? And if that's not what -topMargin et. al. are for, what *are* they for?

--Graham

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to