← Back to team overview

zim-wiki team mailing list archive

Re: Opening attached PDFs on certain pages


On Fri, Nov 23, 2012 at 2:31 PM, kwoodham@xxxxxxxxx <kwoodham@xxxxxxxxx>wrote:

> Not sure if you are using Linux, but I played around on my Mint netbook
> and found somewhat of a workaround for you.
> I placed a single line .sh file in my attachment folder that contains the
> shell command to open the pdf to a specific page, then created a link to it
> in the wiki.
> Name the .sh something useful like "document_page30.sh" and put into the
> file something like:
> /usr/bin/evince /full/path/to/document -p 30
> Probably will have to set the permissions to make the file executable
> I have the Attachment Browser plugin enabled. In the browser, right click
> the .sh and customize the "Open With" to /bin/sh (Before, my default "open
> with" would just open the .sh in the editor and not execute the command -
> see the Zim help pages for Default Applications if you want some
> background).
> Then in your wiki you can create your file link to your .sh file with
> something more descriptive as the text using link markup or Insert -> Links
> (Ctrl-L) - or drag/drop from the attachment folder and edit the link text.
> You are set - close the Attachment Browser if you want to, then in your
> wiki, click on your descriptive link and your pdf will open to the correct
> page.
> This may seek like a lot of hassle - but honestly once you have the "open
> with" set, and one executable .sh file, it's really easy to duplicate the
> .sh to another directory (or replicate it in the current directory if you
> want) and do the quick path/page_number edits - then drag into your wiki
> text.  I was hoping that I could just use a "./file" reference in the
> command since the .sh is usually in the same attachment directory as the
> .pdf, but it's not too big a deal to enter the full path.
> Not elegant, but it works (until something better comes along).

Could think of a simple plugin to do what you do with the script and allow
e.g. to specify the page as a parameter after the file name. But would be
evince specific - need to think how to do this in a generic way.

-- Jaap