[Tutor] Printing from python
Russel Winder
russel at winder.org.uk
Fri Mar 14 19:19:13 CET 2014
On Fri, 2014-03-14 at 11:40 +0100, Ulrich Goebel wrote:
> Hallo,
>
> is there another way to pritt a PDF form python?
>
> My problem is a PDF which is printed well by evince, but not with lp,
> even not out of python using
>
> os.system("lp some_options file.pdf")
Python is deprecating os.system in favour of using the subprocess
package.
subprocess.call('lp some_options file.pdf', shell=True)
or
subprocess.call(['lp', *some_options, 'file.pdf')
assuming some_options is a sequence of strings, on option per string.
> Later on I have to build the PDF in a python program (using reportlab)
> and then print it, even from the python program.
>
> So I look for a (nice documented) library which give access to the CUPS
> API or something else to print the PDF from python.
>
> Any help is welcome!
Debian Sid has packages python-cups and python-cupshelpers which are
Python 2 APIs for working with CUPS. Sadly there do not seem to be
Python 3 versions of these In Debian, but the package in PyPI is pycups
so can be made available to Pytho 3. Also:
http://cyberelk.net/tim/software/pycups/
I have not used these yet myself, but I have trying them out on my
agenda for later in the spring.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/tutor/attachments/20140314/34accb55/attachment.sig>
More information about the Tutor
mailing list