Hello,
I need to send raw variable content to cups with pycups. The attached patch adds a "printData" method on the "cups.Connection" class, allowing printing without writing the data in a temp file. It works like printing from "stdin" with the "lp" command.
Please note that it's my first patch in C for a python module, so it may contain beginner's mistakes.
Sylvain
On Fri, 2013-12-06 at 18:27 +0100, Sylvain GARANCHER (SYLEAM) wrote:
The attached patch adds a "printData" method on the "cups.Connection" class, allowing printing without writing the data in a temp file. It works like printing from "stdin" with the "lp" command.
Thanks very much!
I wonder, though, if it might be better to provide bindings for the underlying libcups functions such as cupsCreateJob(), cupsStartDocument(), cupsWriteRequestData(), and cupsFinishDocument().
Would that be hard to do? Doing it that way would allow the client to e.g. cancel a job that had been started but not finished.
Thanks, Tim. */
2013/12/6 Tim Waugh twaugh@redhat.com:
On Fri, 2013-12-06 at 18:27 +0100, Sylvain GARANCHER (SYLEAM) wrote:
The attached patch adds a "printData" method on the "cups.Connection" class, allowing printing without writing the data in a temp file. It works like printing from "stdin" with the "lp" command.
Thanks very much!
I wonder, though, if it might be better to provide bindings for the underlying libcups functions such as cupsCreateJob(), cupsStartDocument(), cupsWriteRequestData(), and cupsFinishDocument().
Would that be hard to do? Doing it that way would allow the client to e.g. cancel a job that had been started but not finished.
You're right. This new patch adds a binding for these functions, and declares the CUPS_FORMAT_* constants (used for "startDocument" arguments).
Do you think the function I wrote in the first patch (printData) must be written in the final application, or it can be included in the pycups module ?
Thanks, Tim. */
system-config-printer-devel mailing list system-config-printer-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/system-config-printer-devel
Oops, there was a bug in the last patch (writeRequestData accepted only ASCII data).
This new patch fixes the bug. Cordialement, ---
2013/12/7 Sylvain GARANCHER (SYLEAM) sylvain.garancher@syleam.fr:
2013/12/6 Tim Waugh twaugh@redhat.com:
On Fri, 2013-12-06 at 18:27 +0100, Sylvain GARANCHER (SYLEAM) wrote:
The attached patch adds a "printData" method on the "cups.Connection" class, allowing printing without writing the data in a temp file. It works like printing from "stdin" with the "lp" command.
Thanks very much!
I wonder, though, if it might be better to provide bindings for the underlying libcups functions such as cupsCreateJob(), cupsStartDocument(), cupsWriteRequestData(), and cupsFinishDocument().
Would that be hard to do? Doing it that way would allow the client to e.g. cancel a job that had been started but not finished.
You're right. This new patch adds a binding for these functions, and declares the CUPS_FORMAT_* constants (used for "startDocument" arguments).
Do you think the function I wrote in the first patch (printData) must be written in the final application, or it can be included in the pycups module ?
Thanks, Tim. */
system-config-printer-devel mailing list system-config-printer-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/system-config-printer-devel
On Sat, 2013-12-07 at 17:08 +0100, Sylvain GARANCHER (SYLEAM) wrote:
You're right. This new patch adds a binding for these functions, and declares the CUPS_FORMAT_* constants (used for "startDocument" arguments).
Great, thanks. I've committed this.
Do you think the function I wrote in the first patch (printData) must be written in the final application, or it can be included in the pycups module ?
I think it is probably best for that to be in the application rather than pycups. I'm trying to keep pycups "just" the Python glue for libcups.
Tim. */
system-config-printer-devel@lists.fedorahosted.org