Hi Everyone,

Problem:
I'm trying to determine what button a user clicks in PDFViews' print dialog (i.e. Print, Cancel, etc.) so that I can adjust custom PDFPage drawing after the page has printed successfully.

Calling [myPDFView printWithInfo:[NSPrintInfo sharedPrintInfo] autoRotate:YES] provides no way to track the user interaction that ends the NSPrintPanel.

PDFView's print tasks have no "didRunSelector" like NSOperation, so I can't find a way to determine whether the user cancelled the dialog or printed, etc.

Any thoughts?



Attempted alternative solutions:
Since the success of a print task is easy to determine using NSOperation, I tried creating my own print operation as follows:

NSPrintInfo *myPrintInfo = [[NSPrintInfo sharedPrintInfo] initWithDictionary:[[NSDictionary alloc] initWithObjectsAndKeys: @"0", NSPrintBottomMargin, @"0", NSPrintTopMargin, @"0", NSPrintLeftMargin, @"0", NSPrintRightMargin, NULL ]];
        
- (void)printDocument:(id)sender {
        NSPrintOperation *printOp = [NSPrintOperation
                                                        
printOperationWithView:[myPDFView documentView]
                                                        printInfo:myPrintInfo];

        [printOp runOperationModalForWindow:_pdfWindow
                                                                delegate:self
didRunSelector:@selector(printOperationDidRun:success:contextInfo:)
                                                                
contextInfo:NULL];
}

- (void)printOperationDidRun:(NSPrintOperation *)printOperation
success:(BOOL)success
contextInfo:(void *)info {
if (success) {
// Do something here.
}
}


Problems with this solution:
1. Only the visible pages in myPDFView get drawn correctly in the NSPrintPanel's preview and thus print correctly. The rest are grayed out.
2.  Had to set margins to 0 in NSPrintInfo to preview correctly
3.  Also I setDisplaysPageBreaks: to NO for myPDFDocument.
3. Probably missing some custom managing of printing that PDFView does wonderfully (save not providing print job feedback)


Any ideas?

Thanks,

Will
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to