Mac Developer Library

Developer

ApplicationServices Framework Reference CGPSConverter Reference

Options
Deployment Target:

On This Page
Language:

CGPSConverter Reference

CGPSConverterRef is an opaque type used to convert PostScript data to PDF data. The PostScript data is supplied by a data provider and written into a data consumer. When you create a PostScript converter object, you can supply callback functions for Quartz to invoke at various stages of the conversion process,

Functions

  • Tells a PostScript converter to abort a conversion at the next available opportunity.

    Declaration

    Swift

    func CGPSConverterAbort(_ converter: CGPSConverter!) -> Bool

    Objective-C

    bool CGPSConverterAbort ( CGPSConverterRef converter );

    Parameters

    converter

    A PostScript converter.

    Return Value

    A Boolean value that indicates whether the converter is currently converting data (true if it is).

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

  • Creates a new PostScript converter.

    Declaration

    Swift

    func CGPSConverterCreate(_ info: UnsafeMutablePointer<Void>, _ callbacks: UnsafePointer<CGPSConverterCallbacks>, _ options: CFDictionary!) -> CGPSConverter!

    Objective-C

    CGPSConverterRef CGPSConverterCreate ( void *info, const CGPSConverterCallbacks *callbacks, CFDictionaryRef options );

    Parameters

    info

    A pointer to the data that will be passed to the callbacks.

    callbacks

    A pointer to a PostScript converter callbacks structure that specifies the callbacks to be used during a conversion process.

    options

    This parameter should be NULL; it is reserved for future expansion of the API.

    Return Value

    A new PostScript converter, or NULL if a converter could not be created. You are responsible for releasing this object.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

  • Uses a PostScript converter to convert PostScript data to PDF data.

    Declaration

    Swift

    func CGPSConverterConvert(_ converter: CGPSConverter!, _ provider: CGDataProvider!, _ consumer: CGDataConsumer!, _ options: CFDictionary!) -> Bool

    Objective-C

    bool CGPSConverterConvert ( CGPSConverterRef converter, CGDataProviderRef provider, CGDataConsumerRef consumer, CFDictionaryRef options );

    Parameters

    converter

    A PostScript converter.

    provider

    A Quartz data provider that supplies PostScript data.

    consumer

    A Quartz data provider that will receive the resulting PDF data.

    options

    This parameter should be NULL; it is reserved for future expansion of the API.

    Return Value

    A Boolean value that indicates whether the PostScript conversion completed successfully (true if it did).

    Discussion

    The conversion is thread safe, however it is not possible to have more than one conversion job in process within a given address space or process. If a given thread is running a conversion and another thread starts a new conversion, the second conversion will block until the first conversion is complete.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

  • Checks whether the converter is currently converting data.

    Declaration

    Swift

    func CGPSConverterIsConverting(_ converter: CGPSConverter!) -> Bool

    Objective-C

    bool CGPSConverterIsConverting ( CGPSConverterRef converter );

    Parameters

    converter

    A PostScript converter.

    Return Value

    Returns true that indicates if the conversion is in progress.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

  • Returns the Core Foundation type identifier for PostScript converters.

    Declaration

    Swift

    func CGPSConverterGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CGPSConverterGetTypeID ( void );

    Return Value

    The Core Foundation identifier for the opaque type CGPSConverterRef.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

Callbacks

  • Performs custom tasks at the beginning of a PostScript conversion process.

    Declaration

    Objective-C

    typedef void (*CGPSConverterBeginDocumentCallback)(void *info);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Performs custom tasks at the end of a PostScript conversion process.

    Declaration

    Objective-C

    typedef void (*CGPSConverterEndDocumentCallback)(void *info, bool success);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    success

    A Boolean value that indicates whether the PostScript conversion completed successfully (true if it did).

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Performs custom tasks at the beginning of each page in a PostScript conversion process.

    Declaration

    Objective-C

    typedef void (*CGPSConverterBeginPageCallback)(void *info, size_t pageNumber, CFDictionaryRef pageInfo);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    pageNumber

    The current page number. Page numbers start at 1.

    pageInfo

    A dictionary that contains contextual information about the page. This parameter is reserved for future API expansion, and is currently unused.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Performs custom tasks at the end of each page of a PostScript conversion process.

    Declaration

    Objective-C

    typedef void (*CGPSConverterEndPageCallback)(void *info, size_t pageNumber, CFDictionaryRef pageInfo);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    pageNumber

    The current page number. Page numbers start at 1.

    pageInfo

    A dictionary that contains contextual information about the page. This parameter is reserved for future API expansion, and is currently unused.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Reports progress periodically during a PostScript conversion process.

    Declaration

    Objective-C

    typedef void (*CGPSConverterProgressCallback)(void *info);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Passes messages generated during a PostScript conversion process.

    Declaration

    Objective-C

    typedef void (*CGPSConverterMessageCallback)(void *info, CFStringRef message);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    message

    A string containing the message from the PostScript conversion process.

    Discussion

    There are several kinds of message that might 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 and, although uncommon, can be useful in debugging. In addition, there may be error messages if the document is malformed.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Performs custom tasks when a PostScript converter is released.

    Declaration

    Objective-C

    typedef void (*CGPSConverterReleaseInfoCallback)(void *info);

    Parameters

    info

    A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate.

    Import Statement

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

Data Types