print pdf file to network printer using python

Grant Edwards grante at visi.com
Thu Jul 21 11:12:33 EDT 2005


On 2005-07-21, scrimp <scrimp212 at yahoo.com> wrote:
> Well, Ive been searching through google groups and Ive seen a lot about
> printing a pdf file, but I havent seen a definite answer. I tried this
> code:
>
> f = open(printer_path, 'w')
> f.write(pdffile_path)
> f.close()
>
> Basically it doesnt work and what it prints out is the value of
> pdffile_path variable. If anyone can offer some help, Id appreaciate it
> thanks!

You forgot to read the data from the pdf file.

f = open(printer_path, 'w')
f.write(open(pdffile_path,'rb').read())
f.close()

-- 
Grant Edwards                   grante             Yow!  Yow! It's a hole
                                  at               all the way to downtown
                               visi.com            Burbank!



More information about the Python-list mailing list