Instance Method

printOperationWithSettings:error:

Creates and returns a print operation for the document's contents.

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 the Document

printInfo

The printing information associated with the document.

- preparePageLayout:

Adds document-specific content to the Page Layout panel.

- 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 that indicates whether the document allows changes to the default printing information.

- printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:

Prints the document's contents, optionally displaying a print panel to the user.

PDFPrintOperation

A print operation 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.