← Back to team overview

zim-wiki team mailing list archive

Re: Opening attached PDFs on certain pages



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

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

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).

- Kurt

On Tue, Nov 20, 2012 at 10:42 PM, John Geoffrey <gmkeros@xxxxxxxxx> wrote:

> Hello,
> I was just wondering again about something that I thought might be useful:
> sometimes when I attach PDFs to zim pages it is specific pages/articles in
> this pdf I really need. This question might be in the wrong place, because
> pdfs are opened by an external program, but does anyone know a way to link
> to the attachments (or external documents at all) in this case so they will
> open on specific pages?
> So basically it would look something like this: I have a zim page A which
> has an attachment B. B is a book of quite some size with different articles
> in it. During writing page A I decide it is needed to link to article C in
> book B. Now if I link to the attachment it will open the document at the
> beginning or, depending on the program, at the last point I used it.
> Thanks
> _______________________________________________
> Mailing list: https://launchpad.net/~zim-wiki
> Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp

Kurt Woodham
(757) 351-2639 (H)
(757) 864-6067 (W)
(757) 635-6360 (C)

Follow ups