Discussion:
[Skim-app-users] Opening PDF from specified page
Niko Partanen
2016-07-27 19:08:43 UTC
Permalink
Hi! I was searching some time but couldn't find information about this
topic, so I decided to ask here. If the question already has an answer
somewhere, please just point me to that! So I was wondering if there is
a way to open a PDF with Skim from Terminal so that the page from which
I want it open could be specified in the command.

This may be a random question, but being able to do this would fit my
workflow very nicely!

Thank you!

Niko

------------------------------------------------------------------------------
Christiaan Hofman
2016-07-27 20:55:56 UTC
Permalink
Post by Niko Partanen
Hi! I was searching some time but couldn't find information about this
topic, so I decided to ask here. If the question already has an answer
somewhere, please just point me to that! So I was wondering if there is
a way to open a PDF with Skim from Terminal so that the page from which
I want it open could be specified in the command.
This may be a random question, but being able to do this would fit my
workflow very nicely!
Thank you!
Niko
Skim does recognize a page fragment in the URL to open a file at a particular page (a fragment os the part after the # sign in a URL, something like file:///path/to/a/file.pdf#page=N).

However, various commands (like “open”) don’t pas the fragment of a URL (or don’t accept a URL at all) to an app for opening a file, so this would not work.

The only way I know is to use AppleScript and the “open location” command that Skim supports, passing it the URL including the fragment. the AppleScript command looks something like:

tell application “Skim” to open location “file:///path/to/a/file.pdf#page=N"

On the command line you can execute AppleScript using the “osascript” command. You need to take care of properly escaping the double quotes, as well as special characters (like spaces) in the URL.

Christiaan
Niko Partanen
2016-07-28 17:26:14 UTC
Permalink
Thank you for help, this works very well! This is a wonderful feature!

All the best,

Niko
Post by Christiaan Hofman
Post by Niko Partanen
Hi! I was searching some time but couldn't find information about this
topic, so I decided to ask here. If the question already has an answer
somewhere, please just point me to that! So I was wondering if there is
a way to open a PDF with Skim from Terminal so that the page from which
I want it open could be specified in the command.
This may be a random question, but being able to do this would fit my
workflow very nicely!
Thank you!
Niko
Skim does recognize a page fragment in the URL to open a file at a
particular page (a fragment os the part after the # sign in a URL,
something like file:///path/to/a/file.pdf#page=N).
However, various commands (like "open") don't pas the fragment of a
URL (or don't accept a URL at all) to an app for opening a file, so
this would not work.
The only way I know is to use AppleScript and the "open location"
command that Skim supports, passing it the URL including the fragment.
tell application "Skim" to open location
"file:///path/to/a/file.pdf#page=N"
On the command line you can execute AppleScript using the "osascript"
command. You need to take care of properly escaping the double quotes,
as well as special characters (like spaces) in the URL.
Christiaan
------------------------------------------------------------------------------
_______________________________________________
Skim-app-users mailing list
https://lists.sourceforge.net/lists/listinfo/skim-app-users
Loading...