]> git.ipfire.org Git - thirdparty/cups.git/blob - scripting/php/README
Load cups into easysw/current.
[thirdparty/cups.git] / scripting / php / README
1 README - 02/25/2006
2 -------------------
3
4 INTRODUCTION
5
6 This directory contains a dynamically loadable CUPS extension
7 module for PHP 4 and 5. The CUPS 1.2 module has been
8 substantially updated to provide an API more consistent with
9 the C API and is NOT compatible with the CUPS 1.1 module.
10
11
12 COMPILING AND INSTALLING
13
14 Run "make" to compile the PHP CUPS extension:
15
16 make
17
18 To install it, type:
19
20 make install
21
22
23 RESOURCES AND SUPPORT
24
25 Questions should be reported to the CUPS newsgroups/mailing
26 lists at:
27
28 http://www.cups.org/newsgroups.php
29
30 Bug reports and enhancement requests can be submitted via the
31 form at:
32
33 http://www.cups.org/str.php
34
35
36 QUICK REFERENCE DOCUMENTATION
37
38 In lieu of actual documentation, the following definitions
39 can be used as a quick reference to the supported functions:
40
41
42 CUPS_CANCEL_JOB
43
44 Cancels a job on the named destination:
45
46 bool cups_cancel_job(string dest, int id)
47
48 The return value is TRUE on success and FALSE on failure.
49
50 Example:
51
52 if (!cups_cancel_job("myprinter", 123))
53 print("Unable to cancel job: " . cups_last_error_string() . "\n");
54
55
56 CUPS_GET_DESTS
57
58 Gets a list of available destinations:
59
60 array cups_get_dests()
61
62 The return value is an array of objects with the following
63 properties:
64
65 name The name of the printer or class
66 instance The instance of the printer or class
67 is_default TRUE if the printer or class is the default destination
68 options Associative array of options and their values
69
70 Example:
71
72 $dest = cups_get_dests();
73
74
75 CUPS_GET_JOBS
76
77 Gets a list of jobs:
78
79 array cups_get_jobs(string dest, bool myjobs, int completed)
80
81 The "dest" string can be blank for jobs on all destinations.
82 Pass TRUE for "myjobs" to only get jobs for the current user.
83 The "completed" argument can be 0 for pending jobs, 1 for
84 completed jobs, and -1 for all jobs.
85
86 The return value is an array of objects with the following
87 properties:
88
89 id The job ID
90 dest Printer or class name
91 title Title/job name
92 user User the submitted the job
93 format Document format
94 state Job state
95 size Size in kilobytes
96 priority Priority (1-100)
97 completed_time Time the job was completed
98 creation_time Time the job was created
99 processing_time Time the job was processed
100
101 Example:
102
103 $jobs = cups_get_jobs("", FALSE, -1);
104
105
106 CUPS_LAST_ERROR
107
108 Returns the IPP status code for the most recent request:
109
110 int cups_last_error()
111
112 Example:
113
114 $error = cups_last_error();
115
116
117 CUPS_LAST_ERROR_STRING
118
119 Returns the IPP status-message string for the most recent request:
120
121 string cups_last_error_string()
122
123 Example:
124
125 $message = cups_last_error_string();
126
127
128 CUPS_PRINT_FILE
129
130 Prints a single file to a printer or class:
131
132 int cups_print_file(string dest, string filename, string title,
133 array options)
134
135 The return value is the job ID or 0 if there was an error.
136
137 Example:
138
139 $options = array("name" => "value", "name2" => "value2");
140 $id = cups_print_file("dest", "filename", "title", $options);
141
142
143 CUPS_PRINT_FILES
144
145 Prints one or more files to a printer or class:
146
147 int cups_print_files(string dest, array files, string title,
148 array options);
149
150 The return value is the job ID or 0 if there was an error.
151
152 Example:
153
154 $files = array("file1", "file2", "file3");
155 $options = array("name" => "value", "name2" => "value2");
156 $id = cups_print_file("dest", $files, "title", $options);
157