diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2008-02-28 23:00:58 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2008-02-28 23:00:58 +0000 |
commit | 568fa3faf16f8694653600d87955473941cc03c1 (patch) | |
tree | 7cb02898e83751848e3fa61a7821bb651ec361ae /cups/api-cups.shtml | |
parent | d6943d1d3132205deeb6f9ad49ca54091ab3dfe5 (diff) | |
download | cups-568fa3faf16f8694653600d87955473941cc03c1.tar.gz |
Import CUPS 1.4svn-r7356.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@647 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/api-cups.shtml')
-rw-r--r-- | cups/api-cups.shtml | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/cups/api-cups.shtml b/cups/api-cups.shtml index 29982e58d..bc9a05286 100644 --- a/cups/api-cups.shtml +++ b/cups/api-cups.shtml @@ -19,13 +19,24 @@ applications, filters, printer drivers, and backends that need to interface with the CUPS scheduler.</p> +<h3><a name='CLIENTS_AND_SERVERS'>Clients and Servers</a></h3> + +<p>CUPS is based on the Internet Printing Protocol ("IPP"), which allows +clients (applications) to communicate with a server (the scheduler) to get a +list of printers, send print jobs, and so forth. You identify which server +you want to communicate with using a pointer to the opaque structure +<code>http_t</code>. All of the examples in this document use the +<code>CUPS_HTTP_DEFAULT</code> constant, referring to the default connection +to the scheduler. The <a href='api-httpipp.html' target='_top'>HTTP and IPP +APIs</a> document provides more information on server connections.</p> + <h3><a name='PRINTERS_AND_CLASSES'>Printers and Classes</a></h3> <p>Printers and classes (collections of printers) are accessed through the <a href="#cups_dest_t"><code>cups_dest_t</code></a> structure which includes the name (<code>name</code>), instance (<code>instance</code> - -a way of selected certain saved options), and the options and attributes -associated with that destination (<code>num_options</code> and +a way of selecting certain saved options/settings), and the options and +attributes associated with that destination (<code>num_options</code> and <code>options</code>). Destinations are created using the <a href="#cupsGetDests"><code>cupsGetDests</code></a> function and freed using the <a href='#cupsFreeDests'><code>cupsFreeDests</code></a> function. @@ -172,7 +183,8 @@ int num_options = 0; <a href='#cups_dest_t'>cups_dest_t</a> *dest; for (i = 0; i < dest->num_options; i ++) - num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value, num_options, &options); + num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value, + num_options, &options); </pre> <p>Use the <a href='#cupsFreeOptions'><code>cupsFreeOptions</code></a> @@ -199,7 +211,8 @@ int num_options; int job_id; /* Print a single file */ -job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps", "Test Print", num_options, options); +job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps", + "Test Print", num_options, options); </pre> <p>The <a href='#cupsPrintFiles'><code>cupsPrintFiles</code></a> function @@ -237,7 +250,8 @@ int i; char buffer[1024]; /* Create the job */ -job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files", num_options, options); +job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files", + num_options, options); /* If the job is created, add 10 files */ if (job_id > 0) @@ -246,7 +260,8 @@ if (job_id > 0) { snprintf(buffer, sizeof(buffer), "file%d.txt", i); - <a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer, CUPS_FORMAT_TEXT, i == 10); + <a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer, + CUPS_FORMAT_TEXT, i == 10); snprintf(buffer, sizeof(buffer), "File %d\n" @@ -338,7 +353,7 @@ while (job_state < IPP_JOB_STOPPED) <a href='#cupsCancelJob'><code>cupsCancelJob</code></a> function with the job ID:</p> -<pre class='exmaple'> +<pre class='example'> #include <cups/cups.h> <a href='#cups_dest_t'>cups_dest_t</a> *dest; |