1

I am new in python and need your help.

I am writing a GUI in Python from which I would like to refer to specific pages in a PDF.

I can open a PDF on page x following this: Python Open PDF to Bookmark/Named Destination

However, I need to give the path to the Acrobat.exe which I image could be problematic when sending my GUI to someone else.

Is there a way to open a PDF on page x without setting the file path for Acrobat.exe?

martineau
  • 119,623
  • 25
  • 170
  • 301
Tola
  • 254
  • 3
  • 17
  • 1
    You may be able to use `os.system()` and just provide the path to the PDF file as an argument to it (instead of using `subprocess.call()` and providing it with a complete acrobat invoking command sequence as shown in the linked question). – martineau Jul 06 '18 at 14:36
  • I am able to open a PDF just writing this: import os and then os.startfile('test.pdf'). However, then I don't know how to go to a specific page or even better a specific bookmark. – Tola Jul 06 '18 at 16:16
  • 1
    AFAIK there's no way to go to a specific location using `os.system()`β€”it only automatically opens a file with whatever application is associated with the `pdf` file type. On Windows you should be able determine the path to that application from the registry (which is what the OS uses to determine what application to launch to open the file). A script can read the Windows registry using Python's [`winreg`](https://docs.python.org/3/library/winreg.html#module-winreg) module. You should be able to use the OS's `regedit` utility to search the registry for `acrobat.exe` to know where it's located. – martineau Jul 06 '18 at 21:10

0 Answers0