table of contents
| XpGetDocumentData(3Xp) | XPRINT FUNCTIONS | XpGetDocumentData(3Xp) |
NAME¶
XpGetDocumentData - Creates and initializes a new print context.SYNOPSIS¶
cc [ flag... ] file... -lXp [ library... ]
#include <X11/extensions/Print.h> Status XpGetDocumentData ( data_display, context, save_proc, finish_proc, client_data )
Display * data_display;
XPContext context;
XPSaveProc save_proc;
XPFinishProc finish_proc;
XPointer client_data;
ARGUMENTS¶
- data_display
- Specifies a pointer to the Display structure; returned from XOpenDisplay.
- context
- The print context from which document data is to be retrieved.
- save_proc
- A procedure to be registered and called repeatedly to save blocks of document data.
- finish_proc
- A procedure to be registered and called once when the print job has completed and all document data has been sent to save_proc.
- client_data
- Specifies client data to be passed to save_proc and finish_proc when called.
DESCRIPTION¶
XpGetDocumentData registers callbacks that allow a "consumer" to continuously retrieve document data generated in the X Print Server by a separate "producer", where both are referencing the same print context by way of different display connections. Though XpGetDocumentData retrieves document data, its effect is bounded by XpStartJob and XpEndJob. XpGetDocumentData always returns immediately; if an error occurs and the callbacks cannot be registered, the return status is 0, else the return status is non-zero and the callbacks will be called sometime after the return from XpGetDocumentData. This producer/consumer exchange is set up when XpStartJob is called by the producer with output_mode equal XPGetData, and is subsequently initiated when XpGetDocumentData is called by the consumer. Though XpStartJob will return immediately, further attempts to use the producer's display connection may be blocked by the X Print Server until XpGetDocumentData is called on the consumer's display connection.STRUCTURES¶
The save_proc is defined in <X11/extensions/Print.h> as:typedef void (*XPSaveProc)( Display *data_display,
XPContext context,
unsigned char *data,
unsigned int data_len,
XPointer client_data);
typedef void (*XPFinishProc)( Display *data_display,
XPContext context,
XPGetDocStatus status,
XPointer client_data);
After XpGetDocumentData successfully registers the callbacks, any generated X
errors (for example, BadAlloc) or Xp errors (for example, XPBadContext or
XPBadSequence) that are the result of XpGetDocumentData will cause the Xlib
error handler to be invoked, and then will cause finish_proc to be called with
a status of XPGetDocError. Any other activities (for example, a separate
process destroying the print context) that prove fatal to the progress of
XpGetDocumentData will also cause finish_proc to be called with a status of
XPGetDocError.
#define XPGetDocFinished 0 /∗ normal termination */ #define XPGetDocSecondConsumer 1 /∗ setup error */ #define XPGetDocError 2 /∗ progress error */XPGetDocFinished indicates that all intended document data has been delivered by way of save_proc. All cancellation events are guaranteed to have arrived by the time finished_proc is called, and they should be taken into consideration for evaluating the validity of the document data returned.
DIAGNOSTICS¶
- XPBadContext
- A valid print context-id has not been set prior to making this call.
- XPBadSequence
- The function was not called in the proper order with respect to the other X Print Service Extension calls (for example, XpGetDocumentData prior to XpStartJob).
SEE ALSO¶
XpCancelJob(3Xp), XpEndJob(3Xp), XpStartJob(3Xp)| libXp 1.0.0 | X Version 11 |