Derived from | |
Framework | ApplicationServices/ApplicationServices.h |
Companion guide | |
Declared in | CGPSConverter.h |
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,
Tells a PostScript converter to abort a conversion at the next available opportunity.
bool CGPSConverterAbort ( CGPSConverterRef converter );
A PostScript converter.
A Boolean value that indicates whether the converter is currently converting data (true
if it is).
CGPSConverter.h
Uses a PostScript converter to convert PostScript data to PDF data.
bool CGPSConverterConvert ( CGPSConverterRef converter, CGDataProviderRef provider, CGDataConsumerRef consumer, CFDictionaryRef options );
A PostScript converter.
A Quartz data provider that supplies PostScript data.
A Quartz data provider that will receive the resulting PDF data.
This parameter should be NULL
; it is reserved for future expansion of the API.
A Boolean value that indicates whether the PostScript conversion completed successfully (true
if it did).
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.
Important: Although CGPSConverterConvert
is thread safe (it uses locks to prevent more than one conversion at a time in the same process), it is not thread safe with respect to the Resource Manager. If your application uses the Resource Manager on a separate thread, you should either use locks to prevent CGPSConverterConvert
from executing during your usage of the Resource Manager or you should perform your conversions using the Post Script converter in a separate process.
In general, you can avoid this issue by using nib files instead of Resource Manager resources.
CGPSConverter.h
Creates a new PostScript converter.
CGPSConverterRef CGPSConverterCreate ( void *info, const CGPSConverterCallbacks *callbacks, CFDictionaryRef options );
A pointer to the data that will be passed to the callbacks.
A pointer to a PostScript converter callbacks structure that specifies the callbacks to be used during a conversion process.
This parameter should be NULL
; it is reserved for future expansion of the API.
A new PostScript converter, or NULL
if a converter could not be created. You are responsible for releasing this object.
CGPSConverter.h
Returns the Core Foundation type identifier for PostScript converters.
CFTypeID CGPSConverterGetTypeID ( void );
The Core Foundation identifier for the opaque type CGPSConverterRef
.
CGPSConverter.h
Checks whether the converter is currently converting data.
bool CGPSConverterIsConverting ( CGPSConverterRef converter );
A PostScript converter.
Returns true
that indicates if the conversion is in progress.
CGPSConverter.h
Performs custom tasks at the beginning of a PostScript conversion process.
typedef void (*CGPSConverterBeginDocumentCallback)(void *info);
If you name your function MyConverterBeginDocument
, you would declare it like this:
size_t MyConverterBeginDocument ( void *info );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
CGPSConverter.h
Performs custom tasks at the beginning of each page in a PostScript conversion process.
typedef void (*CGPSConverterBeginPageCallback)(void *info, size_t pageNumber, CFDictionaryRef pageInfo);
If you name your function MyConverterBeginDocument
, you would declare it like this:
void MyConverterBeginPage ( void *info, size_t pageNumber, CFDictionaryRef pageInfo );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
The current page number. Page numbers start at 1
.
A dictionary that contains contextual information about the page. This parameter is reserved for future API expansion, and is currently unused.
CGPSConverter.h
Performs custom tasks at the end of a PostScript conversion process.
typedef void (*CGPSConverterEndDocumentCallback)(void *info, bool success);
If you name your function MyConverterEndDocument
, you would declare it like this:
void MyConverterEndDocument ( void *info, bool success );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
A Boolean value that indicates whether the PostScript conversion completed successfully (true
if it did).
CGPSConverter.h
Performs custom tasks at the end of each page of a PostScript conversion process.
typedef void (*CGPSConverterEndPageCallback)(void *info, size_t pageNumber, CFDictionaryRef pageInfo);
If you name your function MyConverterEndPage
, you would declare it like this:
void MyConverterEndPage ( void *info, size_t *pageNumber, CFDictionaryRef pageInfo );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
The current page number. Page numbers start at 1
.
A dictionary that contains contextual information about the page. This parameter is reserved for future API expansion, and is currently unused.
CGPSConverter.h
Passes messages generated during a PostScript conversion process.
typedef void (*CGPSConverterMessageCallback)(void *info, CFStringRef message);
If you name your function MyConverterMessage
, you would declare it like this:
void MyConverterMessage ( void *info, CFStringRef message );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
A string containing the message from the PostScript conversion process.
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.
CGPSConverter.h
Reports progress periodically during a PostScript conversion process.
typedef void (*CGPSConverterProgressCallback)(void *info);
If you name your function MyConverterProgress
, you would declare it like this:
void MyConverterProgress ( void *info );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
CGPSConverter.h
Performs custom tasks when a PostScript converter is released.
typedef void (*CGPSConverterReleaseInfoCallback)(void *info);
If you name your function MyConverterReleaseInfo
, you would declare it like this:
void MyConverterReleaseInfo ( void *info );
A generic pointer to private data shared among your callback functions. This is the same pointer you supplied to CGPSConverterCreate
.
CGPSConverter.h
An opaque data type used to convert PostScript data to PDF data.
typedef struct CGPSConverter *CGPSConverterRef;
CGPSConverter.h
A structure for holding the callbacks provided when you create a PostScript converter object.
struct CGPSConverterCallbacks { unsigned int version; CGPSConverterBeginDocumentCallback beginDocument; CGPSConverterEndDocumentCallback endDocument; CGPSConverterBeginPageCallback beginPage; CGPSConverterEndPageCallback endPage; CGPSConverterProgressCallback noteProgress; CGPSConverterMessageCallback noteMessage; CGPSConverterReleaseInfoCallback releaseInfo; }; typedef struct CGPSConverterCallbacks CGPSConverterCallbacks;
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
.
CGPSConverter.h
© 2003, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-12-22)