Linking from PDF (or other Research documents)

Hey Scrivener forum,

I have a PDF that I’d like to create links on, so that clicking certain hotspots on the PDF will open certain scrivener files within the project. Basically, just like creating a scrivener link, but on a PDF (or other image document in my research / media folders).

It’s not really a deal-breaker, but it would be useful.

The use case is: I’m using scrivener as my Game Master notebook for an RPG. In this case, I’m using a picture of a map I drew on paper and took a photo of (or in other cases, PDF/JPG output from drawing programs). Each room description is a text file in the project. Now I can pretty easily just go and say, "hmm, room 5, I’ll open that file), but it would be ever-so-shiny if I could just click on the map itself.

Sounds like a great idea, but unfortunately the technology isn’t even close to providing it. The problem is that PDF files are displayed by an operating system provided kit. It’s really almost fair to think of them as being displayed by another program entirely. So the level of control over how they are manipulated and displayed is limited and to a degree external. Or to put it another way, you are asking for the ability to create a hyperlink on the Internet that loads your Scrivener project to a certain point. Technologically speaking, if you could do one you could do the other.

As for linking to an individual item with an individual project via a URL, that’s not currently possible. The problem is, the program is designed more like Word than somthing like Evernote. Evernote tyrannically controls your data, period. You have no say over it. But for that you get conveniences like being able to link to pieces of it from anywhere. Programs like Word, TextEdit, Scrivener and so on operate on files that have been saved to your disk. They are ignorant of these files until you open them. They do not have a master archive or library of them. If you sent a URL saying, open X in Y, they would have no clue what “Y” is, or where you might currently be storing it.

So there are really two pieces to the problem here:

  1. The PDF viewing kit that Scrivener uses to display PDF files cannot edit PDF coding in such a way as to add hyperlinks to strings of text
  2. Scrivener is oblivious as to where your project exists and so couldn’t route an external URL to load that project and the item within it to save its life

Now, all of that aside, I did something very similar to this, I believe. Note that you can make freeform corkboards. That means you can attach notes to any location on a grid that you please. Note also that you can set the corkboard background to any picture you please. Save your map to a file, load it as a corkboard background, set your index cards to be small, and you can put points on a map.

I definitely noticed that PDFs and images are getting thrown to the OS to render (zoom functionality, for example, happens with a right-click rather than having a widget in the viewer window decorations). I suppose that this idea is probably Too Much Work to implement, especially given the infrequent use case. Something like a transparent display layer which intercepted click events on top of the OS-rendered canvas wouldn’t work all that well unless you had really good control over what the OS is rendering, at what zoom level, and if I remember Quartz programming all that well, it’s very annoying. Yeah, way too much work.

I don’t need to link to another project (personally), I just use the within-project links in a sorta-kinda-wikiesque fashion. The Wand of Summoning the players found is linked to the text file in the Notable Magic Items folder that describes it. Lots and lots of little files in the project means I can address them at reasonable granularity.

Hmm, the freeform corkboards are definitely a good idea. Either way, I just have the map open in one window and have well-organized folder structures so I can find the appropriate location description.

One fun thing I’ve noticed: porting all these notes into the new system means I get to think hard about all my story design decisions again, remember things I’d forgotten, and revitalize the tale. Pretty fun.

Exactly, it’s one thing to insert a layer over a fixed output, like the compiled PDFs, but quite another in a live display. The compiler does in fact do this, which is how clickable Scrivener Links (in the ToC for instance) are possible. I believe this is how Skim approaches the problem of annotating on top of a PDF being rendered by an external engine. It works well, so it’s not impossible—but then annotating and handling PDF files is all the Skim team has to worry about.

And if that approach were taken, the hyperlinks wouldn’t need to be universal. If you were interacting with a layer that Scrivener generates, then the links could be handled internally in the normal fashion. I just meant, if you could insert actual PDF hyperlinks into the original PDF, then they would need to be something that could access pieces of arbitrary projects from anywhere.

Hmm, I just had an idea for something that might be tangentially useful for this, and generally useful for other purposes. If our Inspector comment system could be used to attach comments to pages of the PDF, this would make for an interesting mechanic. Theoretically that shouldn’t be too difficult. The code for manipulating the scroll position already exists (it is used to retain your spot in the PDF when going from one item to another in the binder, as well as between sessions). So if the comment meta-data stored the location in the PDF where it was “attached”, it could serve as a bookmark just as they do in the standard text editor, and it would give one the ability to insert Scrivener Links relevant to that page, as well. Hmm, I’ll put that into the idea pot for the long-term list.