Skip to content
Marco Filetti edited this page Dec 2, 2016 · 8 revisions

'peyedf' URL Type

As of version 0.5, PeyeDF supports its own “URL Type” (in OS X terminology).

This means that it is possible to communicate to PeyeDF using URLs starting with the peyedf:// protocol. A downside of this is that it's not trivial to determine whether the peyedf protocol is available on a given system, hence the options to open files by using file:// should still be given. However, using a custom URL allows for much greater (and relatively simple) interaction between applications.

Currently, there are two modes that can be used to communicate:

  • reader: opens a file for a new reading session. It can be used by a search engine to direct to a specific search result.
  • refinder: opens a previously read file. Useful for personal indexing services which access own reading data.

These appear where the “host” would normally appear in a URL (e.g. peyedf://refinder/[...])

Reader

The format of the request is:

peyedf://reader/[path_on_disk|contentHash|appId|sessionId]?search=search_query[&page=n][&rect=(x,y,w,h)|&point=(x,y)]

After 'reader/' one can refer to a file using a full path. If the file is already known by DiMe, it is also possible to use a contentHash, a given sessionId or appId.

The search query is optional. If enclosed in double quotes (", %22 escape) it is treated as an exact phrase search (as opposed to an “all words” search).

Optionally, one can focus to a specific block of text using the page and rect parameters. Otherwise, point and page can be used to focus on a broad area of text (to focus on a section heading, for example). The page parameter must be present if either point or rect is used. It is also possible to use page alone, to focus on the beginning of a given page.

Examples:

peyedf://reader/Users/marco/Downloads/Wyble%20et%20al%202009.pdf?search=%22attentional%20blink%22

This opens the ‘Wyble et al 2009.pdf’ file and searches for the “attentional blink” phrase.


peyedf://reader/Users/marco/Downloads/Yan%20et%20al%202007.pdf?rect=(200,400,200,100)&page=3

This opens the ‘Yan et al 2007.pdf’ file and focuses on the given area (with origin 200 (x) , 400 (y) and size 200 (width), 100 (height)).


peyedf://reader/Users/marco/Downloads/Yan%20et%20al%202007.pdf?point=(200,200)&page=1

This opens the same file as before, but instead navigates to a point approximately in the middle of page 2 (or 1, if we start counting from 0).

Refinder

The format of the request is:

peyedf://refinder/sessionId?page=page_number[&rect=(x,y,w,h)|&point=(x,y)]

SessionId is the unique id assigned to each reading session (from document open until window close). All ReadingEvent and SummaryReadingEvent instances have a sessionId that relates them to each other.

Optionally, one can focus to a specific block of text using the page and rect parameters. Otherwise, point and page can be used to focus on a broad area of text (to focus on a section heading, for example). The page parameter must be present if either point or rect is used. It is also possible to use page alone, to focus on the beginning of a given page.

Examples:


peyedf://refinder/ddd2576160f9f7fda74c12e273e7be240f9eca1f

Opens the document with the given sessionId and shows annotations from that reading session.


peyedf://refinder/ddd2576160f9f7fda74c12e273e7be240f9eca1f?point=(200,200)&page=1

Opens the same reading session and in addition focuses to that point on page 2 (if starting from 1).


peyedf://refinder/f20851522b8ec3bf7bfbd37c7b4d50487d47ce88?rect=(100,400,200,100)&page=3

Opens another reading session and focuses on the given block of text on page 4 (if starting from 1). The given block of text could be something previously annotated, for example.

## Future versions

Currently, the search parameter is only used in the reader function. In a future version, it will be possible to use it also for the refinder functionality.

Clone this wiki locally