Callbacks provide a way for Quartz to inform your application of the status of the conversion. If your application has a user interface, you can use the status information for provide feedback to the user, as shown in Figure 15-1.
You can provide callbacks to inform your application that Quartz 2D is:
Starting the conversion (CGPSConverterBeginDocumentCallback). Quartz 2D passes your callback a generic pointer to data you supply.
Ending the conversion (CGPSConverterEndDocumentCallback). Quartz 2D passes your callback a generic pointer to data you supply and a Boolean value that indicates success (true) or failure (false).
Starting a page (CGPSConverterBeginPageCallback). Quartz 2D passes your callback a generic pointer to data you supply, the page number, and a CFDictionary object, which is currently not used.
Ending a page (CGPSConverterEndPageCallback). Quartz 2D passes your callback a generic pointer to data you supply and a Boolean value that indicates success (true) or failure (false)
Progressing with the conversion (CGPSConverterProgressCallback). This callback is invoked periodically throughout the conversion. Quartz 2D passes your callback a generic pointer to data you supply.
Sending a message about the process (CGPSConverterMessageCallback). There are several kinds of messages that can be sent during a conversion process. The most likely are font substitution messages, and any messages that the PostScript code itself generates. Any PostScript messages written to stdout are routed through this callback—typically these are debugging or status messages. In addition, there can be error messages if the document is malformed.
Quartz 2D passes your callback a generic pointer to data you supply and a CFString object that contains a message about the conversion.
Deallocating the PostScript converter object (CGPSConverterReleaseInfoCallback). You can use this callback to deallocate the generic pointer if you’ve provided data and to perform any additional postprocessing tasks. Quartz 2D passes your callback a generic pointer to data you supply.
See the CGPSConverter documentation in Quartz 2D Reference Collection for the prototype each callback follows.
Last updated: 2007-12-11