Mac Developer Library

Developer

ApplicationServices Framework Reference CGPSConverter Reference

Options
Deployment Target:

On This Page
Language:

CGPSConverter Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreGraphics

Objective-C

@import CoreGraphics;

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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Swift

    typealias CGPSConverterBeginDocumentCallback = CFunctionPointer<((UnsafeMutablePointer<Void>) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

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

    Declaration

    Swift

    typealias CGPSConverterEndDocumentCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, Bool) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Swift

    typealias CGPSConverterBeginPageCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, Int, CFDictionary!) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    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

    Swift

    typealias CGPSConverterEndPageCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, Int, CFDictionary!) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Reports progress periodically during a PostScript conversion process.

    Declaration

    Swift

    typealias CGPSConverterProgressCallback = CFunctionPointer<((UnsafeMutablePointer<Void>) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Passes messages generated during a PostScript conversion process.

    Declaration

    Swift

    typealias CGPSConverterMessageCallback = CFunctionPointer<((UnsafeMutablePointer<Void>, CFString!) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • Performs custom tasks when a PostScript converter is released.

    Declaration

    Swift

    typealias CGPSConverterReleaseInfoCallback = CFunctionPointer<((UnsafeMutablePointer<Void>) -> Void)>

    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

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

Data Types

  • An opaque data type used to convert PostScript data to PDF data.

    Declaration

    Swift

    typealias CGPSConverterRef = CGPSConverter

    Objective-C

    typedef struct CGPSConverter *CGPSConverterRef;

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A structure for holding the callbacks provided when you create a PostScript converter object.

    Declaration

    Swift

    struct CGPSConverterCallbacks { var version: UInt32 var beginDocument: CGPSConverterBeginDocumentCallback var endDocument: CGPSConverterEndDocumentCallback var beginPage: CGPSConverterBeginPageCallback var endPage: CGPSConverterEndPageCallback var noteProgress: CGPSConverterProgressCallback var noteMessage: CGPSConverterMessageCallback var releaseInfo: CGPSConverterReleaseInfoCallback init() init(version version: UInt32, beginDocument beginDocument: CGPSConverterBeginDocumentCallback, endDocument endDocument: CGPSConverterEndDocumentCallback, beginPage beginPage: CGPSConverterBeginPageCallback, endPage endPage: CGPSConverterEndPageCallback, noteProgress noteProgress: CGPSConverterProgressCallback, noteMessage noteMessage: CGPSConverterMessageCallback, releaseInfo releaseInfo: CGPSConverterReleaseInfoCallback) }

    Objective-C

    struct CGPSConverterCallbacks { unsigned int version; CGPSConverterBeginDocumentCallback beginDocument; CGPSConverterEndDocumentCallback endDocument; CGPSConverterBeginPageCallback beginPage; CGPSConverterEndPageCallback endPage; CGPSConverterProgressCallback noteProgress; CGPSConverterMessageCallback noteMessage; CGPSConverterReleaseInfoCallback releaseInfo; }; typedef struct CGPSConverterCallbacks CGPSConverterCallbacks;

    Fields

    version

    The version number of the structure passed in as a parameter to the converter creation functions. The structure defined below is version 0.

    beginDocument

    The callback called at the beginning of the conversion of the PostScript document, or NULL.

    endDocument

    The callback called at the end of conversion of the PostScript document, or NULL.

    beginPage

    The callback called at the start of the conversion of each page in the PostScript document, or NULL.

    endPage

    The callback called at the end of the conversion of each page in the PostScript document, or NULL.

    noteProgress

    The callback called periodically during the conversion to indicate that conversion is proceeding, or NULL.

    noteMessage

    The callback called to pass any messages that might result during the conversion, or NULL.

    releaseInfo

    The callback called when the converter is deallocated, or NULL.

    Availability

    Available in OS X v10.3 and later.