how to open PDF file at specific page in the terminal?

6,187

Solution 1

Evince is a PDF viewer able to open PDF files at a specific page using the terminal with the following command:

evince -i 5 "path/to/document.pdf"

where -i option specifies the page of the document, 5 in this example, and the second argument specifies the path to the document to open.

Okular is a PDF viewer able to open PDF files at a specific page using the terminal with the following command:

okular -p 5 "path/to/document.pdf"

where -p option specifies the page of the document, 5 in this example, and the second argument specifies the path to the document to open.

Acrobate Reader is a PDF viewer able to open PDF files at a specific page using the terminal with the following command:

/opt/Adobe/Reader9/bin/acroread /a "page=5" "path/to/document.pdf"

where page=5 is the argument that specifies the page of the document, 5 in this example, and the second argument specifies the path to the document to open.

Solution 2

The Firefox PDF viewer will open at a page number by appending #page= followed by the page number to the URL, for example

firefox "file://$PWD/myfile.pdf#page=150"

The quotes are necessary if there is a space in your current path name. I like to use symbolic links and this won't work from the shell if the file is a symbolic link, but this does

firefox "file://$(realpath myfile.pdf)#page=150"
Share:
6,187

Related videos on Youtube

TheUltimateSource
Author by

TheUltimateSource

Updated on September 18, 2022

Comments

  • TheUltimateSource
    TheUltimateSource over 1 year

    I am trying to open a .pdf file with FoxitReader from the terminal.

    The following works on the terminal:

    /opt/foxitsoftware/foxitreader/FoxitReader "Document.pdf"

    But this doesn't:

    /opt/foxitsoftware/foxitreader/FoxitReader "Document.pdf /A page=5" It launches the FoxitReader GUI application, displaying "the file could not be found". The document has more than 5 pages.

    • Foxit Reader version is 2.4.1.0609
    • Ubuntu 16.04

    is this option not available for linux systems? Did the syntax change? Do I need to install a plugin?

    I also tried

    /opt/foxitsoftware/foxitreader/FoxitReader -h
    /opt/foxitsoftware/foxitreader/FoxitReader --help
    

    but it fails to open these, too :(

    Edit: I attempted the same in Adobe Acrobat Reader

    /opt/Adobe/Reader9/bin/acroread /A "page=3" "Document.pdf"
    

    with the same result. As always, instructions are documented for windows. I tried a couple of other PDF viewer now...

    is there any free PDF reader able to:

    • run in linux
    • open PDF at a specific page
    • highlight text
    • display page in full view (optional)

    ?

    thank you

    • TheUltimateSource
      TheUltimateSource over 5 years
      evince -i 5 "Document.pdf" works
    • TheUltimateSource
      TheUltimateSource over 5 years
      okular -p 5 "Document.pdf" works
    • Chai T. Rex
      Chai T. Rex over 5 years
      Hello. Please add those as an answer below. You can edit your answer later if you discover new ways of doing it. After a while, you'll be able to accept the best answer by clicking the checkmark to the left of it, which can be yours if you want.
    • TheUltimateSource
      TheUltimateSource over 5 years
      aww, God, the option is lowercase for linux instead of uppercase. This is NOT according to the documentation. That settles it for Acrobat, Foxit's still refusing to work.