Hallo ich möchte das beim drücken auf ein Button ein Dokument ausgedrückt wird.
Folgenden Code verwende ich:
	
		
			
		
		
	
			Alles anzeigen
		
								
			
Ich bekomme aber zur Laufzeit folgende Fehlermeldung:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
2011-06-16 13:52:58.644 MTContentManager[1758:903] -[NSWindow initWithContentsOfFile:]: unrecognized selector sent to instance 0x100528580
2011-06-16 13:52:58.645 MTContentManager[1758:903] -[NSWindow initWithContentsOfFile:]: unrecognized selector sent to instance 0x100528580
Habt ihr eine Idee woran das liegen kann?
									
									
								Folgenden Code verwende ich:
Quellcode
- - (IBAction)Drucken:(id)sender {
- // Create the print settings.
- NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
- [printInfo setTopMargin:0.0];
- [printInfo setBottomMargin:0.0];
- [printInfo setLeftMargin:0.0];
- [printInfo setRightMargin:0.0];
- [printInfo setHorizontalPagination:NSFitPagination];
- [printInfo setVerticalPagination:NSFitPagination];
- // NSURL* nsurl=[NSURL URLWithString:@"de.openoffice.org/doc/sonstiges/Iso-Image-brennen.pdf"];
- NSData* data;
- NSString* pfad = [@"/Users/neuerdrachen/my.pdf" stringByExpandingTildeInPath];
- [data initWithContentsOfFile:pfad];
- // Create the document reference.
- PDFDocument *pdfDocument = [[[PDFDocument alloc] initWithData:data] autorelease];
- // Invoke private method.
- // NOTE: Use NSInvocation because one argument is a BOOL type. Alternately, you could declare the method in a category and just call it.
- BOOL autoRotate = YES;
- NSMethodSignature *signature = [PDFDocument instanceMethodSignatureForSelector:@selector(getPrintOperationForPrintInfo:autoRotate:)];
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
- [invocation setSelector:@selector(getPrintOperationForPrintInfo:autoRotate:)];
- [invocation setArgument:&printInfo atIndex:2];
- [invocation setArgument:&autoRotate atIndex:3];
- [invocation invokeWithTarget:pdfDocument];
- // Grab the returned print operation.
- NSPrintOperation *op = nil;
- [invocation getReturnValue:&op];
- // Run the print operation without showing any dialogs.
- [op setShowsPrintPanel:YES];
- [op setShowsProgressPanel:YES];
- [op runOperation];
- }
Ich bekomme aber zur Laufzeit folgende Fehlermeldung:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}
2011-06-16 13:52:58.644 MTContentManager[1758:903] -[NSWindow initWithContentsOfFile:]: unrecognized selector sent to instance 0x100528580
2011-06-16 13:52:58.645 MTContentManager[1758:903] -[NSWindow initWithContentsOfFile:]: unrecognized selector sent to instance 0x100528580
Habt ihr eine Idee woran das liegen kann?
 
									 
 