I found the following code which saves the contents of a NSTextView to
a PDF. This codde handles the paging and gives the user the standard
dialog asking where to save the file. I am wondering if I can save the
view (in my case a webView ) directly to a filename that I specify
without asking the user to name the file. Is this possible?
NSPrintInfo *printInfo;
NSPrintInfo *sharedInfo;
NSPrintOperation *printOp;
NSMutableDictionary *printInfoDict;
NSMutableDictionary *sharedDict;
sharedInfo = [NSPrintInfo sharedPrintInfo];
sharedDict = [sharedInfo dictionary];
printInfoDict = [NSMutableDictionary
dictionaryWithDictionary:sharedDict];
[printInfoDict setObject:NSPrintSaveJob
forKey:NSPrintJobDisposition];
[printInfoDict setObject:[sheet filename]
forKey:NSPrintSavePath];
printInfo = [[NSPrintInfo alloc] initWithDictionary:
printInfoDict];
[printInfo setHorizontalPagination: NSAutoPagination];
[printInfo setVerticalPagination: NSAutoPagination];
[printInfo setVerticallyCentered:NO];
printOp = [NSPrintOperation printOperationWithView:textView
printInfo:printInfo];
[printOp setShowPanels:NO];
[printOp runOperation];
(Original code from
http://cocoadevcentral.com/articles/000074.php)
Thanks for any help...
Michael