Instance Method

printOperationWithSettings:error:

Creates a print operation and returns it if successful.

Declaration

- (NSPrintOperation *)printOperationWithSettings:(NSDictionary<NSPrintInfoAttributeKey, id> *)printSettings error:(NSError * _Nullable *)outError;

Parameters

printSettings

The print settings dictionary to use.

outError

On return, if the print operation could not be created, a pointer to an error object that encapsulates the reason it could not be created.

Return Value

The print operation, or nil if unsuccessful.

Discussion

The print operation can be run to print the document’s current contents. The NSPrintInfo attributes in the passed-in printSettings dictionary are added to a copy of the document’s print info, and the resulting print info is used for the operation.

See Also

Printing Documents

printInfo

The printing information associated with the document.

- preparePageLayout:

Invoked by runModalPageLayoutWithPrintInfo: and runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo: to do any customization of the Page Layout panel pageLayout, such as adding an accessory view.

- runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:

Runs the modal page layout panel with the receiver’s printing information object

- runModalPrintOperation:delegate:didRunSelector:contextInfo:

Runs the specified print operation modally.

- shouldChangePrintInfo:

Returns a Boolean value indicating whether the receiver should allow changes to the default NSPrintInfo object used in printing the document.

PDFPrintOperation

A print operation that you can use to create a PDF representation of the document’s current contents.

- saveDocumentToPDF:

Exports a PDF representation of the document’s current contents.