launching adobe reader with arguments from os.system call

G

Greg Miller

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!!
 
M

Martin Miller

Greg said:
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!!

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
 
G

Greg Miller

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
 
S

Steve Holden

Greg said:
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
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
 
G

Greg Miller

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top