Inherits from: NSObject
Package: com.apple.yellow.application
An NSPrintOperation object controls operations that generate Encapsulated PostScript (EPS) code or PostScript print jobs. Generally, EPS code is used to transfer images between applications, which happens when the user copies and pastes graphics, uses a Service, or uses ObjectLinks. PostScript is generated when the user prints and faxes documents. An NSPrintOperation object does not generate PostScript code itself; it just controls the overall process, relying on an NSView object to generate the actual code.
NSPrintOperation works in conjunction with two other objects: an NSPrintInfo object, which specifies how the code should be generated, and an NSView object, which performs the actual code generation. You specify these two objects in the method you use to create an NSPrintOperation object. If no NSPrintInfo is specified, NSPrintOperation uses the shared NSPrintInfo, which contains default values. (A shared NSPrintInfo object is automatically created for an application.) The shared NSPrintInfo works well for applications that are not document-based. However, document-based applications should create an NSPrintInfo for each document that might be printed or copied and use that object instead. This will allow users to set printing attributes on a per-document basis.
You create NSPrintOperation objects in any method that is invoked when a user chooses a Print or Copy command. That method must also send runOperation to the NSPrintOperation object to start the actual operation.
When repeating a print job, you can suppress the display of
the NSPrintPanel object by sending setShowPanels, passing false
as
the argument, to the NSPrintOperation object before sending it runOperation. However,
make sure that any non-default settings in the NSPrintInfo object
that would normally be selected from a NSPrintPanel object are set
to reasonable values-a copy of an NSPrintInfo object used in a
previous print job will have the correct values.
You can also customize the NSPrintPanel object using the setAccessoryView method or specify your own NSPrintPanel object using setPrintPanel (an OpenStep addition).
If you want the PostScript code generated for EPS and printing to be the same but different from the code generated for the screen, you can test for this case by sending isDrawingToScreen to the current NSDPSContext.
If you want to generate different PostScript code when printing vs. creating EPS, you can test for this case by sending isEPSOperation to the current operation.
These constants specify the page order. They're used by pageOrder and setPageOrder.
Order | Meaning |
AscendingPageOrder |
Ascending (back to front) page order. |
DescendingPageOrder |
Descending (front to back) page order. |
SpecialPageOrder |
The spooler will not rearrange pages-they are print in the order received by the spooler. |
UnknownPageOrder |
No page order specified. |
- Creating an NSPrintOperation
- EPSOperationWithView:insideRect:toData:
- EPSOperationWithView:insideRect:toData:printInfo:
- EPSOperationWithView:insideRect:toPath:printInfo:
- printOperationWithView:
- printOperationWithView:printInfo:
- initEPSOperationWithView:insideRect:toData:printInfo:
- initWithView:printInfo:
- Setting the current NSPrintOperation for this thread
- currentOperation
- setCurrentOperation
- Determining the type of operation
- isEPSOperation
- Modifying the NSPrintInfo object
- printInfo
- setPrintInfo
- Getting the NSView object
- view
- Running a print operation
- runOperation
- cleanUpOperation
- deliverResult
- Modifying the user interface
- showPanels
- setShowPanels
- accessoryView
- setAccessoryView
- printPanel
- setPrintPanel
- Managing the DPS context
- context
- createContext
- destroyContext
- Modifying page information
- currentPage
- pageOrder
- setPageOrder
public NSPrintOperation(NSView aView, NSPrintInfo aPrintInfo)
See Also: - initEPSOperationWithView:insideRect:toData:printInfo:
public NSPrintOperation(NSView aView, NSRect rect, NSMutableData data, NSPrintInfo aPrintInfo)
public static NSPrintOperation EPSOperationWithViewInsideRect(NSView aView, NSRect rect, NSMutableData data)
public static NSPrintOperation EPSOperationWithViewInsideRect(NSView aView, NSRect rect, NSMutableData aNSMutableData, NSPrintInfo aPrintInfo)
public static NSPrintOperation EPSOperationWithViewInsideRect(NSView aView, NSRect rect, String path, NSPrintInfo aPrintInfo)
public static NSPrintOperation currentOperation()
null
if
there isn't a current operation.See Also: setCurrentOperation
public static NSPrintOperation printOperationWithView(NSView aview)
public static NSPrintOperation printOperationWithView(NSView aView, NSPrintInfo aPrintInfo)
See Also: + printOperationWithView:
public static void setCurrentOperation(NSPrintOperation operation)
null
,
then there is no current print operation.See Also: currentOperation
public NSView accessoryView()
See Also: printPanel, setPrintPanel, setShowPanels, showPanels
public void cleanUpOperation()
public NSDPSContext context()
See Also: createContext, destroyContext
public NSDPSContext createContext()
See Also: context, destroyConte, xt
public int currentPage()
See Also: pageOrder, setPageOrder
public boolean deliverResult()
true
if
the operation was successful, false
otherwise.
Do not invoke this method directly-it's invoked automatically
when the operation is done generating the output.public void destroyContext()
See Also: context, createContext
public boolean isEPSOperation()
true
if
the receiver controls an EPS operation (initiated by a copy command),
and false
if the receiver controls
a printing operation (initiated by a print command).public int pageOrder()
See Also: currentPage
public NSPrintInfo printInfo()
See Also: setPrintInfo
public NSPrintPanel printPanel()
See Also: accessoryView, setAccessoryView, setPrintPanel, setShowPanels, showPanels
public boolean runOperation()
true
if successful, false
otherwise.See Also: cleanUpOperation, deliverResult
public void setAccessoryView(NSView aView)
See Also: accessoryView, printPanel, setPrintPanel, setShowPanels, showPanels
public void setPageOrder(int order)
AscendingPageOrder
DescendingPageOrder
SpecialPageOrder
UnknownPageOrder
See Also: currentPage, pageOrder
public void setPrintInfo(NSPrintInfo aPrintInfo)
See Also: printInfo
public void setPrintPanel(NSPrintPanel panel)
See Also: accessoryView, printPanel, setAccessoryView, setShowPanels, showPanels
public void setShowPanels(boolean flag)
true
then
the NSPrintPanel will be used in the operation, otherwise it will
not.See Also: accessoryView, printPanel, setAccessoryView">- setAccessoryView, setPrintPanel, showPanels
- (BOOL)showPanels
true
if
the NSPrintPanel will be used in the operation, otherwise false
.See Also: accessoryView, printPanel, setAccessoryView, setPrintPanel, setShowPanels
public NSView view()