Re: can't find a way to display and print pdf through python.






I'm using Suse Linux which has five program that
will open a pdf file from a shell command line.
Acrobat Reader is one of the five.

A right button click on the file should give a
list of programs that will open a PDF file.

Im using a KDE desktop
Open a shell, add the path to the directory where
the PDF file lives, and on the command line type;

xpdf myfile.pdf ## may also work on a Gnome
## Desktop
or any of these for the KDE desktop;

kpdf myfile.pdf
Kghostview myfile.pdf
konqueror myfile.pdf ## my browser + myfile.

Acrobat Reader is also listed on my system. It
open files as adobe reader using the mouse to
open a pdf file but not from the command line
with an arg, and I haven't spent the time to
figgure out why.


You will have to import os and some combination of
any of the exec.. args, or the popen, spawn, or
system modules.

os.execvep() ## or others like execl, execle ....
os.spawnv(),
os.spawnve(),
os.popen()

hope this give some direction.

jim-on-linux







On Tuesday 13 February 2007 03:44, Jussi Salmela
wrote:
Grant Edwards kirjoitti:
On 2007-02-12, Larry Bates
<larry.bates@xxxxxxxxxxx> wrote:
Grant Edwards wrote:
On 2007-02-12, Larry Bates
<larry.bates@xxxxxxxxxxx> wrote:
On 2007-02-12, Larry Bates
<larry.bates@xxxxxxxxxxx> 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
.



Relevant Pages

  • Re: close pdf file before closing excel
    ... all instances of acrobat reader, even though I specified the command line as ... When a user closes the excel model, I would like excel to check whether ... pdf file is open, and if it is, then excel should close the pdf file ...
    (microsoft.public.excel.programming)
  • [SLE] Re: converting pdf file
    ... > This is not a suse rather a linux specific issue. ... > I have a pdf file in which the sizes of the pages are half of an ... First of all get the package psutils, then at the command line type this in: ... Jim Hatridge ...
    (SuSE)
  • Re: close pdf file before closing excel
    ... all instances of acrobat reader, even though I specified the command line as ... When a user closes the excel model, I would like excel to check whether ... pdf file is open, and if it is, then excel should close the pdf file ... Command line contains the ...
    (microsoft.public.excel.programming)
  • Re: VB/VBA File Open As when Filename has no extension
    ... I'm trying to use the Shell command to have Adobe Acrobat Reader open ... a PDF File. ...
    (microsoft.public.vb.general.discussion)
  • Re: print a pdf file
    ... > I am trying to execute a pdf file from java program in ... > windows 2000 using the command ... First of all, the Acrobat reader is probably not in your path, so you'll ...
    (microsoft.public.win2000.new_user)