linking to specific pages in pdfs

Index » Learning resources

  • 1
 
Reply #1 - 2010 April 21, 2:22 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

So I was just thinking how cool it would be to able to link to specific pages in a document, sort of like we have with Google Books, but for offline .pdf files, and say, while in Anki. Any idea how to accomplish this? ;p

Usage would be to refer from, say, example sentences or simply text excerpts back to the source document...

Edit: Here's what I found so far:

http://ic.ucsc.edu/tutorials/linkingtopdfs/

For .djvu: http://www.uky.edu/KGS/djvu/Support/djvuplugin35.html

Not sure if it works for offline files... Wonder how to do it for .doc files... or local .html documents? (I guess that would require inserting an id thingy...)

Last edited by nest0r (2010 April 21, 2:26 am)

Reply #2 - 2010 April 21, 2:36 am
Nemotoad Member
Registered: 2010-03-17 Posts: 66

I mentioned the wired marker add-on for Firefox before: http://forum.koohii.com/viewtopic.php?id=5604. It allows you to link to sentences or selected text (or images) in pdfs as well as other document types by creating anchors. You can access this information while working offline in Firefox too I think.

Erm, I really don't work for them, really, I just think it's a cool tool for research! You can also export your text later on for use in Anki (or whatever). I'm not sure about the linking in Anki part - I suppose you could link back to your stored file in Firefox. I've been too busy to look at wired marker in depth but it seems conceivable that if an anchor is created, you can refer back to that anchor.

Reply #3 - 2010 April 21, 2:38 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

Woohoo! It works (From my first comment, not that Wired thingy)! Well, I use Foxit Reader, so the format is different: For the card in Anki, use the HTML Editor to make a link: <a href="path to pdf" -n [pagenumber here, no brackets]>link</a>!

I guess if you store a copy of the relevant documents in the .media folder, that'll simplify things, but as a trivial tangent, sharing might be problematic, unless there's a way to make it go to the .media folder regardless? Otherwise I guess you'd have to do a find/replace on the exported deck or something, no big deal...

Edit: And I guess with .doc files, you'd need to insert a bookmark then create a link to that...

Last edited by nest0r (2010 April 21, 3:19 am)

Advertising (register and sign in to hide this)
JapanesePod101 Sponsor
 
Reply #4 - 2010 April 22, 1:35 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

Oh, I'm stupid, that Foxit link doesn't actually work, it's just that the page number was stored in my cache. It opens the pdf but that's all. sad I was wondering how I managed to get the command line in the href thingy, but checking it, it was removed. ;p

I'm sure the Acrobat #page= works, though. At this point I can't remember why I wanted to bother, seems like I should keep doing what I was doing before, putting in the page numbers and just doing it manually, and that only when I didn't bother copy/pasting big chunks of test when it's an OCR'd .pdf...

Last edited by nest0r (2010 April 22, 2:10 am)

Reply #5 - 2010 April 22, 2:16 am
Nemotoad Member
Registered: 2010-03-17 Posts: 66

Fine, fine, reject my wired marker add-on with scorn then. :-p

Reply #6 - 2010 April 22, 2:21 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

Nemotoad wrote:

Fine, fine, reject my wired marker add-on with scorn then. :-p

Why would I bother if I can't click from an Anki card to specific pages in a pdf? Otherwise I'd just copy/paste the text into the card or keep the .pdf open and type in the page number. ;p No need to introduce another reader or whatever...

I think I already installed/uninstalled 5000 note-taking addons and programs over the years, never really had much use for them, I just use UltraEdit (and Firefox bookmarks ;p). And MyLifeOrganized, on and off...

I was almost tempted to install Adobe since it allows pagenumbers in the URLs without command line or whatever, but it creeps me out. Sticking with manual stuff.

Anyway, don't mind me, just feeling grouchy.

Last edited by nest0r (2010 April 22, 2:28 am)

Reply #7 - 2010 April 22, 4:02 am
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

The html command is...
<a href="document.pdf#page=3">Text of link/a>

or, if you have set a named destination in your PDF (bookmarks point to named destinations) you can link to it like this...
<a href="document.pdf#introduction_section">Text of link</a>

You can't have spaces in the address string, and obviously you cant pass parameters outside the parentheses like in your first attempt.

edit: I'm not sure if Anki will support this as it uses Webkit, which often is a bit less full-featured than a browser.

edit2: this functionality is in adobe acrobat, but probably not any other PDF reader, so you'll have to have Acrobat set as your default for PDFs.

Last edited by Blahah (2010 April 22, 4:08 am)

Reply #8 - 2010 April 22, 4:19 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

@Blahah - I already wrote all that above, but thanks. ;p

Reply #9 - 2010 April 22, 4:42 am
Blahah Member
From: Cambridge, UK Registered: 2008-07-15 Posts: 715 Website

Whoops... I'll just follow you around the forums confirming everything you say...

Reply #10 - 2010 April 22, 5:14 am
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

Thanks for your support.

Reply #11 - 2010 April 22, 8:52 am
cangy Member
From: 平安京 Registered: 2006-12-13 Posts: 372 Website

nest0r wrote:

Not sure if it works for offline files...

not so much...

Reply #12 - 2010 April 22, 1:26 pm
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

cangy wrote:

nest0r wrote:

Not sure if it works for offline files...

not so much...

Ah, good thing I didn't install Adobe then. ;p

Reply #13 - 2010 October 15, 3:57 pm
nest0r Member
Registered: 2007-10-19 Posts: 5236 Website

It just occurred to me if I turn the pdf pages to images via conversion or screenshots, I could have the images on the cards (either as part of the usual card or solo as an Anki 'Book' somehow w/ each card a page) or set it up so they're off the card but still linked from the card, maybe. Does Anki let you create clickable links to other cards (like how there's a link to a card when you create new cards and it says '1 card added etc'? Or perhaps you can link to hard drive images via Anki so when you click them they open in the default image browser?

Speaking of which, if you can create links from card to card, that could make for interesting strategies, re: my card chain idea from way back when... hmm...

Last edited by nest0r (2010 October 15, 4:00 pm)

Reply #14 - 2013 March 10, 9:20 am
Cormbit New member
From: Usa Registered: 2012-07-24 Posts: 2

I think
http://stackoverflow.com/questions/1001 … ge-section
This might be able to help you. If you grab the page with pyPdf and then write it with pdfwriter, you could just open the new single paged pdf file from anki. smile

Reply #15 - 2013 March 10, 9:23 am
Stian Member
From: England Registered: 2012-06-21 Posts: 426

Look at the date of the post above you. wink

Reply #16 - 2013 March 10, 10:03 am
toshiromiballza Member
Registered: 2010-10-27 Posts: 277

Since it's already bumped...

Making Firefox 19 the default pdf viewer and using the parameter #page=X after the filename (for example, file.pdf#page=4) works. You can even go further and select zoom and exact location where you want to focus the pdf on.

  • 1