Up

# NSPrintOperation

### Authors

Scott Christley (`scottc@net-community.com`)
Fred Kiefer (`FredKiefer@gmx.de`)
Adam Fedor (`fedor@gnu.org`)
Chad Hardin (`cehardin@mac.com`)

> Controls generation of EPS, PDF or PS print jobs.

Copyright: (C) 1996,2001,2004 Free Software Foundation, Inc.

### Contents -

1. Class
2. Software documentation for the NSPrintOperation(Private) category

# Class Description

NSPrintOperation controls printing of an NSView. When invoked normally it will (optionally) display a standard print panel (NSPrintPanel), and based on the information entered by the user here as well as information about page layout (see NSPageLayout) tells the NSView to print it's contents. NSPrintOperation works with the NSView to paginate the output into appropriately sized and oriented pages and finally delivers the result to the appropriate place, whether it be a printer, and PostScript file, or another output.

## NSPrintOperation : NSObject

> Declared in:
>   AppKit/NSPrintOperation.h

Availability: OpenStep
Description forthcoming.

Instance Variables
Method summary

- -initWithView:insideRect:toData:printInfo:
- +EPSOperationWithView:insideRect:toData:
- +EPSOperationWithView:insideRect:toData:printInfo:
- +EPSOperationWithView:insideRect:toPath:printInfo:
- +PDFOperationWithView:insideRect:toData:
- +PDFOperationWithView:insideRect:toData:printInfo:
- +PDFOperationWithView:insideRect:toPath:printInfo:
- +currentOperation
- +printOperationWithView:
- +printOperationWithView:printInfo:
- +setCurrentOperation:
- -accessoryView
- -canSpawnSeparateThread
- -cleanUpOperation
- -context
- -createContext
- -currentPage
- -deliverResult
- -destroyContext
- -initEPSOperationWithView:insideRect:toData:printInfo:
- -initWithView:printInfo:
- -isCopyingOperation
- -isEPSOperation
- -jobStyleHint
- -pageOrder
- -printInfo
- -printPanel
- -runOperation
- -runOperationModalForWindow:delegate:didRunSelector:contextInfo:
- -setAccessoryView:
- -setCanSpawnSeparateThread:
- -setJobStyleHint:
- -setPageOrder:
- -setPrintInfo:
- -setPrintPanel:
- -setShowPanels:
- -setShowsPrintPanel:
- -setShowsProgressPanel:
- -showPanels
- -showsPrintPanel
- -showsProgressPanel
- -view

### EPSOperationWithView: insideRect: toData:

+ (NSPrintOperation*) EPSOperationWithView: (NSView*)aView insideRect: (NSRect)rect toData: (NSMutableData*)data;
Availability: OpenStep
Description forthcoming.

### EPSOperationWithView: insideRect: toData: printInfo:

+ (NSPrintOperation*) EPSOperationWithView: (NSView*)aView insideRect: (NSRect)rect toData: (NSMutableData*)data printInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Description forthcoming.

### EPSOperationWithView: insideRect: toPath: printInfo:

+ (NSPrintOperation*) EPSOperationWithView: (NSView*)aView insideRect: (NSRect)rect toPath: (NSString*)path printInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Description forthcoming.

### PDFOperationWithView: insideRect: toData:

+ (NSPrintOperation*) PDFOperationWithView: (NSView*)aView insideRect: (NSRect)rect toData: (NSMutableData*)data;
Availability: MacOS-X 10.0.0
Description forthcoming.

### PDFOperationWithView: insideRect: toData: printInfo:

+ (NSPrintOperation*) PDFOperationWithView: (NSView*)aView insideRect: (NSRect)rect toData: (NSMutableData*)data printInfo: (NSPrintInfo*)aPrintInfo;
Availability: MacOS-X 10.0.0
Description forthcoming.

### PDFOperationWithView: insideRect: toPath: printInfo:

+ (NSPrintOperation*) PDFOperationWithView: (NSView*)aView insideRect: (NSRect)rect toPath: (NSString*)path printInfo: (NSPrintInfo*)aPrintInfo;
Availability: MacOS-X 10.0.0
Description forthcoming.

### currentOperation

+ (NSPrintOperation*) currentOperation;
Availability: OpenStep
Returns the NSPrintOperation object that is currently performing a print operation (if any).

### printOperationWithView:

+ (NSPrintOperation*) printOperationWithView: (NSView*)aView;
Availability: OpenStep
Description forthcoming.

### printOperationWithView: printInfo:

+ (NSPrintOperation*) printOperationWithView: (NSView*)aView printInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Description forthcoming.

### setCurrentOperation:

+ (void) setCurrentOperation: (NSPrintOperation*)operation;
Availability: OpenStep
Set the current NSPrintOperation to the supplied operation object. As this is currently implemented, if a NSPrintOperation is currently running, that operation is lost (along with any associated context), so be careful to call this only when there is no current operation.

### accessoryView

- (NSView*) accessoryView;
Availability: MacOS-X 10.0.0
Returns the accessory view used by the NSPrintPanel associated with the receiver.

### canSpawnSeparateThread

- (BOOL) canSpawnSeparateThread;
Availability: MacOS-X 10.0.0
Description forthcoming.

### cleanUpOperation

- (void) cleanUpOperation;
Availability: OpenStep
Called by the print operation after it has finished running a printing operation.

### context

- (NSGraphicsContext*) context;
Availability: OpenStep
Returns the graphic contexts used by the print operation.

### createContext

- (NSGraphicsContext*) createContext;
Availability: OpenStep
This method is used by the print operation to create a special graphics context for use while running the print operation.

### currentPage

- (int) currentPage;
Availability: OpenStep
Returns the page currently being printing. Returns 0 if no page is currently being printed

### deliverResult

- (BOOL) deliverResult;
Availability: OpenStep
Called by the print operation to deliver the results of the printing operation. This might include sending the output to a printer, a file or a previewing program. Returns `YES` if the output was delivered sucessfully.

### destroyContext

- (void) destroyContext;
Availability: OpenStep
This method is used by the print operation to destroy the special graphic context used while running the print operation.

### initEPSOperationWithView: insideRect: toData: printInfo:

- (id) initEPSOperationWithView: (NSView*)aView insideRect: (NSRect)rect toData: (NSMutableData*)data printInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Description forthcoming.

### initWithView: printInfo:

- (id) initWithView: (NSView*)aView printInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Description forthcoming.

### isCopyingOperation

- (BOOL) isCopyingOperation;
Availability: MacOS-X 10.0.0
Description forthcoming.

### isEPSOperation

- (BOOL) isEPSOperation;
Availability: OpenStep
Returns `YES` if the receiver is performing an operation whose output is EPS format.

### jobStyleHint

- (NSString*) jobStyleHint;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### pageOrder

- (NSPrintingPageOrder) pageOrder;
Availability: OpenStep
Returns the page order of printing.

### printInfo

- (NSPrintInfo*) printInfo;
Availability: OpenStep
Returns the NSPrintInfo object associated with the receiver.

### printPanel

- (NSPrintPanel*) printPanel;
Availability: OpenStep
Returns the NSPrintPanel associated with the receiver.

### runOperation

- (BOOL) runOperation;
Availability: OpenStep
Call this message to run the print operation on a view. This includes (optionally) displaying a print panel and working with the NSView to paginate and draw the contents of the view.

### runOperationModalForWindow: delegate: didRunSelector: contextInfo:

- (void) runOperationModalForWindow: (NSWindow*)docWindow delegate: (id)delegate didRunSelector: (SEL)didRunSelector contextInfo: (void*)contextInfo;
Availability: MacOS-X 10.0.0
Run a print operation modally with respect to a window.

### setAccessoryView:

- (void) setAccessoryView: (NSView*)aView;
Availability: MacOS-X 10.0.0
Set the accessory view used by the NSPrintPanel associated with the receiver.

### setCanSpawnSeparateThread:

- (void) setCanSpawnSeparateThread: (BOOL)flag;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setJobStyleHint:

- (void) setJobStyleHint: (NSString*)hint;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### setPageOrder:

- (void) setPageOrder: (NSPrintingPageOrder)order;
Availability: OpenStep
Set the page order used when printing.

### setPrintInfo:

- (void) setPrintInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Set the NSPrintInfo object associated with the receiver.

### setPrintPanel:

- (void) setPrintPanel: (NSPrintPanel*)panel;
Availability: OpenStep
Sets the NSPrintPanel used by the receiver obtaining and displaying printing information from/to the user.

### setShowPanels:

- (void) setShowPanels: (BOOL)flag;
Availability: OpenStep
Use this to set whether a print panel is displayed during a printing operation. If set to `NO`, then the receiver uses information that was previously set and does not display any status information about the progress of the printing operation.

### setShowsPrintPanel:

- (void) setShowsPrintPanel: (BOOL)flag;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### setShowsProgressPanel:

- (void) setShowsProgressPanel: (BOOL)flag;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### showPanels

- (BOOL) showPanels;
Availability: OpenStep
Returns `YES` if the reciever display an NSPrintPanel and other information when running a print operation.

### showsPrintPanel

- (BOOL) showsPrintPanel;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### showsProgressPanel

- (BOOL) showsProgressPanel;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### view

- (NSView*) view;
Availability: OpenStep
Return the view that is the being printed.

## Instance Variables for NSPrintOperation Class

### _accessory_view

@protected NSView* _accessory_view;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _context

@protected NSGraphicsContext* _context;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _currentPage

@protected int _currentPage;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _data

@protected NSMutableData* _data;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _flags

@protected struct __Flags _flags;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _job_style_hint

@protected NSString* _job_style_hint;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _page_order

@protected NSPrintingPageOrder _page_order;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _path

@protected NSString* _path;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _print_info

@protected NSPrintInfo* _print_info;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _print_panel

@protected NSPrintPanel* _print_panel;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _rect

@protected NSRect _rect;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _view

@protected NSView* _view;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

# Software documentation for the NSPrintOperation(Private) category

## NSPrintOperation(Private)

> Declared in:
>   AppKit/NSPrintOperation.h

Availability: OpenStep
Warning this category is private, which means that the methods are for internal use by the package. You should not use them in external code.
Method summary

- -initWithView:insideRect:toData:printInfo:

### initWithView: insideRect: toData: printInfo:

- (id) initWithView: (NSView*)aView insideRect: (NSRect)rect toData: (NSMutableData*)data printInfo: (NSPrintInfo*)aPrintInfo;
Availability: OpenStep
Description forthcoming.

Up