[vtkusers] creating pdf of a VTK view in objective-c
Olivier Fedrigo
ofedrigo at duke.edu
Thu Dec 1 14:15:32 EST 2005
Hi,
I implemented a VTK viewer in objective-c and I try to save the image
as a pdf file. It works well for any NSView but I can't figure out
how to save a VTK view.
here is my code (again it works well for nsview but I get a "blank"
pdf file for the VTK view)
- (IBAction)SavePDF:(id)sender
{
NSSavePanel *panel=[NSSavePanel savePanel];
[panel setRequiredFileType:@"pdf"];
[panel beginSheetForDirectory:nil file: nil modalForWindow:[NSApp
mainWindow] modalDelegate:self didEndSelector: @selector
(PDF:returnCode:contextInfo:) contextInfo:nil];
}
-(void)PDF:(NSSavePanel*)sheet returnCode:(int)code contextInfo:
(void*)contextInfo
{
if (code==NSOKButton)
{
NSData* data=[VTK_view dataWithPDFInsideRect:[VTK_view bounds]];
[data writeToFile:[sheet filename]atomically:YES];
}
}
thanks a lot,
Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051201/96b33501/attachment.htm>
More information about the vtkusers
mailing list