1 #ifndef PRINTERQUEUES_H
2 #define PRINTERQUEUES_H
3 
4 #ifdef __cplusplus
5         extern "C" {
6 #endif
7 
8 #define PRINTERQUEUE_CUSTOMCOMMAND "<Use custom print command>"
9 #define PRINTERQUEUE_SAVETOFILE "<Save to file>"
10 
11 enum pqinfo_datatype {PQINFO_POSTSCRIPT,PQINFO_RAW};
12 
13 struct pqprivate;
14 
15 struct pqinfo
16 {
17 	void (*Dispose)(struct pqinfo *pq);
18 
19 	/***** For querying the available printer queues *****/
20 
21 	int (*GetPrinterCount)(struct pqinfo *pq);
22 	char *(*GetPrinterName)(struct pqinfo *pq,int index);
23 
24 	/* Get and set the current printer queue... */
25 	const char *(*GetPrinterQueue)(struct pqinfo *pq);
26 	void (*SetPrinterQueue)(struct pqinfo *pq,const char *queue);
27 
28 	/* Returns the gutenprint driver associated with
29 	   the queue, or NULL if unknown.  */
30 
31 	char *(*GetDriver)(struct pqinfo *pq);
32 
33 	/* Returns the PPD associated with the the queue,
34 	   or NULL if unknown or not applicable. */
35 
36 	char *(*GetPPD)(struct pqinfo *pq);
37 
38 
39 	/***** Output Options *****/
40 
41 #ifndef WIN32
42 	/* Custom command (Unix only)
43 	   If a custom command is set, then instead of piping data to the
44 	   queue's default command, it will be piped to the custom command. */
45 
46 	const char *(*GetCustomCommand)(struct pqinfo *pq);
47 	void (*SetCustomCommand)(struct pqinfo *pq,const char *cmd);
48 
49 #endif
50 
51 	/* Set Extended Options - No-op on Win32 or non-CUPS unix queues.
52 	   On CUPS-capable systems, provide extra options in the form:
53 	   -oopt=value -oopt=value ... */
54 
55 	void (*SetExtendedOptions)(struct pqinfo *pq,const char *extendedopts);
56 
57 
58 	/* Saving to a file (Unix and Windows)
59 	   Redirects the print data to a file.
60 	   Uses a callback function to get the output filename at print-time.
61        Use like this:
62 
63 	   Define a function that returns a filename - must return a full path,
64 	   which will be free()d once the file is open:
65 
66        char *mygetfnfunc(void *userdata)
67 	   {
68 	     struct myuserdata *ud=(struct myuserdata *ud)userdata;
69 		 [do user interface stuff here]
70 	     return(filename);
71 	   }
72 
73 	   pqinfo->SetGetFilenameCallback(pqinfo,mygetfnfunc,userdata);
74 
75 	*/
76 
77 	void (*SetGetFilenameCallback)(struct pqinfo *pq,char *(*getfilename)(void *userdata),void *userdata);
78 
79 	/***** Job Handling *****/
80 	void (*SetDataType)(struct pqinfo *pq,enum pqinfo_datatype type);
81 	int (*InitialiseJob)(struct pqinfo *pq);
82 	void (*InitialisePage)(struct pqinfo *pq);
83 	void (*EndPage)(struct pqinfo *pq);
84 	void (*EndJob)(struct pqinfo *pq);
85 	void (*CancelJob)(struct pqinfo *pq);
86 
87 	/* Function to write data to the printer queue */
88 	int (*WriteData)(struct pqinfo *pq,const char *data,int bytecount);
89 
90 	struct pqprivate *priv;
91 };
92 
93 struct pqinfo *pqinfo_create();
94 
95 #ifdef __cplusplus
96     }
97 #endif
98 
99 #endif
100