Preview of printer output in an NSView????
Preview of printer output in an NSView????
- Subject: Preview of printer output in an NSView????
- From: dkb <email@hidden>
- Date: Sat, 11 Sep 2004 14:56:32 -0500
Is there ANY better example or documentation that would allow me to to display in an NSView exactly what the user would see if he/she printed my NSView? There seems to be a lot of confusion on margins, imageable area, etc, from previous posts.
As I understand it, the
imageablePageBounds area is the total possible area that the printer hardware can print to. You still have to take into account the margins. Yet, an example on apple's site uses the paper size minus the margins for the size of the view that fits on a single page (http://developer.apple.com/documentation/Cocoa/Conceptual/Printing/Tasks/PaginatingViews.html).
If I create an NSView with a framerect equal to
imageablePageBounds minus the top and bottom margins, and then print this view, the NSView is actually only about 75% of the actual printable area on the printer.
I would simply like to display in an NSScrollView a "print preview" of what the user would see if they printed. The output is very dynamic and is basically a report engine, hence the need for the user to see what will be printed before they choose to print.
Here is the relevant code (without the subtraction of margins since even this page height is too small):
printInfo = [NSPrintInfo sharedPrintInfo];
NSLog(@"printinfo: %@", printInfo);
[printInfo setHorizontallyCentered:NO];
[printInfo setVerticallyCentered:NO];
NSRect imageArea = [printInfo imageablePageBounds];
imageableHeight = imageArea.size.height;
//imageableHeight = [self calculatePrintHeight];
imageableWidth = imageArea.size.width;
NSSize viewSize = NSMakeSize(imageableWidth,imageableHeight);
[outputView setFrameSize:viewSize];
Here is the printinfo:
printinfo: {
NSBottomMargin = 90;
NSCopies = 1;
NSFirstPage = 1;
NSHorizonalPagination = 2;
NSHorizontallyCentered = 1;
NSJobDisposition = NSPrintSpoolJob;
NSLastPage = 2147483647;
NSLeftMargin = 72;
NSMustCollate = 1;
NSOrientation = 0;
NSPaperName = "na-letter";
NSPaperSize = <44190000 44460000 >;
NSPrintAllPages = 1;
NSPrintProtected = 0;
NSPrinter = {
"Device Description" = {NSDeviceIsPrinter = YES; };
"Language Level" = 3;
Name = i950;
Type = "Canon i950";
};
NSRightMargin = 72;
NSSavePath = "";
NSScalingFactor = 1;
NSTopMargin = 90;
NSVerticalPagination = 0;
NSVerticallyCentered = 1;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden