can't find a way to display and print pdf through python.
peter
peter.mctaggart at gmail.com
Tue Feb 13 05:45:40 EST 2007
On Feb 13, 7:44 pm, Jussi Salmela <tiedon_j... at hotmail.com> wrote:
> Grant Edwards kirjoitti:
>
> > On 2007-02-12, Larry Bates <larry.ba... at websafe.com> wrote:
> >> Grant Edwards wrote:
> >>> On 2007-02-12, Larry Bates <larry.ba... at websafe.com> wrote:
> >>>> On 2007-02-12, Larry Bates <larry.ba... at websafe.com> wrote:
> >>>>>>> I at least need the code for useing some library for
> >>>>>>> connecting to acrobat reader and giving the print command on
> >>>>>>> windows and some thing similar on ubuntu linux.
> >>>>>> Just let the registered .PDF viewer do it for you.
>
> >>>>>> os.start('myfile.pdf')
> >>>>> Eh? I don't see os.start() it either 2.5 or 2.44
> >>>>> documentation, and it's sure not there in 2.4.3:
> >>>> My bad. os.system()
> >>> That doesn't work either:
>
> >>> $ ls -l user.pdf
> >>> -rw------- 1 grante users 35640 2005-11-21 14:33 user.pdf
>
> >>> $ python
> >>> Python 2.4.3 (#1, Dec 10 2006, 22:09:09)
> >>> [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
> >>> Type "help", "copyright", "credits" or "license" for more
> >>> information.
> >>> >>> import os
> >>> >>> os.system('user.pdf')
> >>> sh: user.pdf: command not found
> >>> 32512
>
> >> Works fine on my system. You linux guys just have it hard.
> >> The op said "windows".
>
> > The posting to which you replied specified Linux.
>
> >> I can't answer for ubuntu linux but maybe you can help there?
>
> > I don't see how. Pdf files just aren't executable.
>
> On Windows, this (where fileName is xyz.PDF, for example):
> webbrowser.open(r'file://' + fileName)
> starts Acrobat Reader with the document read in. I have no idea why,
> because Acrobat Reader sure ain't my browser;)
>
> Maybe someone could try this out on Linux.
>
> Cheers,
> Jussi
Works on Ubuntu -- this opens a tab in my browser and then launches
Document Viewer to view the PDF.
peter at astro:~$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.open(r'file:///home/peter/appa.pdf')
>>>
More information about the Python-list
mailing list