PMSessionGetCGGraphicsContext(_:_:)
Obtains the Quartz graphics context for the current page in a printing session.
Declaration
func PMSessionGetCGGraphicsContext(_ printSession: PMPrintSession, _ context: UnsafeMutablePointer<Unmanaged<CGContext>?>) -> OSStatusParameters
- printSession:
The printing session whose Quartz graphics context you want to obtain.
- context:
A pointer to your Cgcontext variable. On return, the variable refers to the Quartz graphics context for the current page in the specified printing session. The context’s origin is at the lower-left corner of the sheet of paper, not the imageable area. You should not release the context without first retaining it. The context is valid only for the current page; you should not retain it beyond the end of the page.
Return Value
A result code. See Result Codes.
Discussion
If you’re using Quartz 2D to draw the content for a print job, after each call to PMSessionBeginPage you should call PMSessionGetCGGraphicsContext to obtain the Quartz graphics context for the current page. Note that before you can use the function PMSessionGetCGGraphicsContext, you must have called PMSessionBeginCGDocument or PMSessionBeginCGDocumentNoDialog(_:_:_:) instead of PMSessionBeginDocument or PMSessionBeginDocumentNoDialog.