Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Blakeasd

macrumors 6502a
Original poster
Dec 29, 2009
643
0
Hello,
I am attempting to save the contents from an NSView to a PDF file at the resolution 1920x1200. I found the method:
Code:
dataWithPDFInsideRect:

I got the data from the view saved to a NSData object. My question is how do I save and open the file at 1920x1200 now that I have the NSData object with the PDF data.
Thanks
 
Hello,
I am attempting to save the contents from an NSView to a PDF file at the resolution 1920x1200. I found the method:
Code:
dataWithPDFInsideRect:

I got the data from the view saved to a NSData object. My question is how do I save and open the file at 1920x1200 now that I have the NSData object with the PDF data.
Thanks

from the documentation for that method:
NSView -dataWithPDFInsideRect: said:
Discussion
This data can be placed on an NSPasteboard object, written to a file, or used to create an NSImage object.

NSImage is the easiest way to handle displaying a PDF. You can set the size of the NSImage in the image itself or draw the image into a rect if the size you want. Just initialize the NSImage with the data you saved. What could be simpler?
 
I know how to save it as an NSImage but how do I save it as a PDF to the Desktop or a Folder? My project is Document-Based but I'm not sure about what method I should use.
 
I know how to save it as an NSImage but how do I save it as a PDF to the Desktop or a Folder? My project is Document-Based but I'm not sure about what method I should use.

The NSData object should contain the bytes of the PDF file. Try sending it one of the writeToFile or writeToURL messages.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.