- (void)print:(id)sender {
// page settings for printing
[self setPrintInfo:[NSPrintInfo sharedPrintInfo]];
[printInfo setVerticalPagination:NSAutoPagination];
float horizontalMargin, verticalMargin;
horizontalMargin = 0;
verticalMargin = -100;
[printInfo setLeftMargin:horizontalMargin];
[printInfo setRightMargin:horizontalMargin];
[printInfo setHorizontallyCentered:YES];
[printInfo setTopMargin:-600];
[printInfo setBottomMargin:verticalMargin];
[sampleText setHidden:NO];
[[NSPrintOperation printOperationWithView:staticText] runOperation];
}
Connect this method to the button you want to provide the print option
No comments:
Post a Comment