Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

launching adobe reader with arguments from os.system call

20 views
Skip to first unread message

Greg Miller

unread,
Sep 6, 2005, 10:24:54 AM9/6/05
to
Currently I am launching adobe reader using the following call:
os.system("path.file.pdf")
this works fine for opening the pdf doc at the beginning. We would like
to enhance this and open the document to either a page or a nameddest
in the doc. The syntax for that in the DOS command prompt world is:
acroRd32.exe /A "nameddest=Before You Begin" "path.file.pdf"
However the os.system call won't allow me to call reader using that
syntax. Does anyone know how I can launch the Reader application and
pass in the parameters required to allow the document to be opened to
the named destination? Thanks in advance!!

Martin Miller

unread,
Sep 6, 2005, 5:05:18 PM9/6/05
to

I'm not sure how/if you can do what you want with os.system(), but this
is what I've used to pass arguments directly to applications on
Windows:
> # spawn text editor on file
> import os
> applpath = r'C:\Windows\system32\notepad.exe'
> filepath = r'D:\My Documents\somefile.txt'
> os.spawnv(
> os.P_WAIT,
> applpath,
> [ # argument list
> applpath,
> filepath
> ]
> )

A downside is that it requires you to know the full path to the
application, 'acroRd32.exe' in your case. On the other hand, I think
you could pass just about any argument values (as strings) that you
wished in the list passed as the third argument.

HTH,
-Martin

Greg Miller

unread,
Sep 8, 2005, 7:31:02 AM9/8/05
to
Thank you Martin, here's what I discovered this morning to work, the
only problem is it is painfully slow to launch the application.

os.system('start acroRd32.exe'+' /A'+' "page=15"'+'
"C:\\Gregtemp\\estelletest\\NexGlosser_User_Guide_W60G00_en.pdf"')

I'm going to give your method a try to see if it launches any quicker.
Thanks again.

Greg Miller

Steve Holden

unread,
Sep 8, 2005, 10:37:05 AM9/8/05
to pytho...@python.org
You might notice that if you already have an Acrobat Reader window open
the document comes up rather more quickly.

If you want fast document startup you could consider using the win32all
extensions to create an AcroReader application process in advance of
opening any documents.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Greg Miller

unread,
Sep 8, 2005, 12:53:22 PM9/8/05
to
Thank you for the information, when I launched the Reader on the actual
hardware it launched quickly. I think I just have too much running on
my application PC. I will consider starting an AcroReader app however.

Greg

0 new messages