0

I have read many answers that explain how to open a PDF file to a specific page; from this answer, the solution is something like this:

import subprocess
import os

path_to_pdf = os.path.abspath('C:\test_file.pdf')
# I am testing this on my Windows Install machine
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe') 

# this will open your document on page 12
process = subprocess.Popen([path_to_acrobat, '/A', 'page=12', path_to_pdf], shell=False, stdout=subprocess.PIPE)
process.wait()

However, I have found nowhere how to open a PDF to a specific page label (in case the page number does not match the page label, that is a problem).
How can I do that?



PS: In case it is not clear, in this image you see the difference between page number (274) and page label (208).

Plato
  • 1
  • 1
  • 1
  • Does this have to be for a specific PDF, or do you want this to be a generic solution? If it for a specific one then all you'd have to do is add or subtract a fixed amount from the page number you want to navigate to, but since you're posting here it seems like you want this to work on multiple PDFs with different offsets. – Random Davis Jul 06 '21 at 15:27
  • It would be better if it were a generic solution. However, it might also help to know just how to get the page _label_ associated to a certain page _number_ (in order to obtain that "fixed amount") – Plato Jul 06 '21 at 15:56

0 Answers0