Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Objective-C

Table of Contents

NSPDFImageRep


Inherits from:
NSImageRep : NSObject
Conforms to:
NSCoding
(NSImageRep)
NSCopying NSImageRep)
NSObject (NSObject)
Declared in:
AppKit/NSPDFImageRep.h




Class Description


An NSPDFImageRep is an object that can render an image from a PDF format data stream.

Like most other kinds of NSImageReps, an NSPDFImageRep is generally used indirectly, through an NSImage object. An NSImage must be able to choose from among various representations of a given image. It also needs to provide an off-screen cache of the appropriate depth for any image it uses. It determines this information by querying its NSImageReps.

Thus to work with an NSImage, an NSPDFImageRep must be able to provide some information about its image. The bounding box is obtained from the PDF format data. Use these methods, inherited from the NSImageRep class, to set the other attributes of an NSPDFImageRep object:

Note that if these attributes aren't set, and an NSPDFImageRep is used in an NSImage with other representations, NSImage won't be able to select from among the representations. In actual practice, this usually isn't a problem.




Method Types


Creating an NSPICTImageRep
+ imageRepWithData:
- initWithData:
Getting image data
- bounds
- PDFRepresentation


Class Methods



imageRepWithData:

+ (id)imageRepWithData:(NSData*)pdfData

Creates a new NSPDFImageRep instance and then invokes initWithData: to initialize it with the contents of pdfData, a PDF format data stream. If the new object can't be initialized for any reason (for example, pdfData doesn't conform to the PDF file format), this method frees the receiver and returns nil. Otherwise, it returns a new instance of NSPDFImageRep.

See Also: - PDFRepresentation




Instance Methods



bounds

- (NSRect)bounds

Returns the rectangle that bounds the image. The rectangle is obtained from the PDF format data.

initWithData:

- (id)initWithData:(NSData*)pdfData

Initializes the receiver, a newly allocated NSPDFImageRep object, with the contents of pdfData, a PDF format data stream. If the new object can't be initialized for any reason (for example, pdfData doesn't conform to the PDF file format), this method frees the receiver and returns nil. Otherwise, it returns self.

See Also: + imageRepWithData:, - PDFRepresentation



PDFRepresentation

- (NSData*)PDFRepresentation

Returns the PDF representation of the receiver. The returned PDF data is a copy of the data supplied to initWithData:.


Table of Contents