Open PDF

Dan dan at cellectivity.com
Thu Sep 22 10:16:09 EDT 2005


> I would like to know how to open a PDF document from a python script

You mean open it and display it to the user? Under Windows you may be
able to get away with just "executing" the file (as though it were an
executable):

  import os
  os.system("c:/path/to/file.pdf")

Under Linux you can probably use xpdf or gpdf:

  os.system("xpdf /path/to/file.pdf")

Note that you should check the return code of "system" to see if the
execution was successful. For example, the user might not have xpdf
installed.

-- 
  Don't try to be charming, witty or intellectual. Just be yourself.
      - Mrs. Cuomo's poorly worded advice to her husband (then
        governor of New York) shortly before his speech to the
        New York Press Club





More information about the Python-list mailing list