Skip to content Skip to sidebar Skip to footer

Open Pdf To Bookmark/named Destination?

I'm trying to open a PDF to a specific bookmark using python. So far, I'm able to run the following command in Command Prompt and get exactly what I want (last is the name of a na

Solution 1:

FIXED:

I'm an idiot.

"C:\\Users\\User\Desktop\test.pdf"

is an invalid path because the \t in \test.pdf is interpretted as a tab... It works after adding changing it to \test.pdf.

Code for anyone with the same problem later:

import os
import subprocess

page = "3"  
path_to_pdf = os.path.abspath("C:\\Users\\User\Desktop\\test.pdf")
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe')


process = subprocess.Popen([path_to_acrobat, '/n', '/A', 'page=' + page, path_to_pdf], shell=False, stdout=subprocess.PIPE)

process.wait()

Post a Comment for "Open Pdf To Bookmark/named Destination?"