Easily create linked document from current page

Is there a feature in DThink to quickly generate a new document that links to the currently open PDF page? I have bought the program devonthinkforhistorians (.com) and it includes something called a Super Annotation which is a custom data template that creates a new document including a link to the current PDF page, but I’m having the problem that running the New from Template process does not generate a NEW document if the template has been run before on the current PDF. It will instead reopen the last document created for the PDF, using that template.

This is kind of frustrating because I’d like to create a lot of these and so I’m looking for a streamlined workflow.


We didn’t produce nor do we control the template you’re referring to.

See the Inspectors > Annotations & Reminders section of the built-in Help and manual for information on how to create and use an annotation file.

If you want a bunch of linked documents to a PDF, use the PDF’s annotation file as a map of things you want to link to.

Use control-option-command-O to open the annotation in a separate window. Then navigate to the things you want to reference and hit control-option-command-C to copy the item link.

Back in the annotation file command-V will produce the link.

The files you linked to will show the PDF’s annotation file as an incoming link. If your annotation template generated a link to the PDF (it should), then you can go from a linked file back to the PDF with two mouse clicks.

Annotation files are awesome.


I was wanting to have multiple annotation files per PDF, but that doesn’t appear to be easily supported. I figured out a workaround though. I’ll just split my PDF’s up into multiple PDF files and put them into folders to retain their original groupings (each PDF is actually a collection of documents, altogether representing one physical box from the archive).

Thanks for the support.

Yes, a document can only have one associated annotation file.

1 Like

Interesting. It seems legit, at least from a running-with-scissors standpoint, to create an annotation and then move it anywhere you want. You could put an annotation in a group with other files you want to regard as annotations, for example. Or, tag annotations. All that is easily done after opening the annotation in a full edit window.

I also see Data->Move (Control-Command-M) is a nicer way to move files than the right-click context menu I’ve always used. I really need to explore more.

at least from a running-with-scissors standpoint, to create an annotation and then move it anywhere you want.

Technically speaking, yes you can move them to another location in a database.

You could put an annotation in a group with other files you want to regard as annotations, for example.

There is already a preference to put annotation files in the same group as the referring document or in an Annotations group. See Preferences > General > General

What is the difference between “In shared group” and “In same group”? These sound like the same thing to me.

I tried both settings and it doesn’t seem to have any effect when creating annotation files from the templates I’m using.

It has to do with where the annotation files are stored.

“In same group” means in the same group as the parent document. “In shared group” means annotations will go in a top level group called Annotations.

The appearance of the annotation isn’t dependent on where it is stored.

If you open an annotation and hit Command-R, you’ll see where the annotation is stored.

1 Like

You could use a script to create notes linking back to current PDF page. Below is the one I use.

I’m not much of a scripter and it could, I’m sure, be improved by someone who has the skills but it works for me.

-- Creates note with link to PDF and selected text (if any text selected)

use AppleScript version "2.4"
use framework "AppKit"
use scripting additions

property theDelimiter : return & return -- or e.g. linefeed & linefeed
property theSeparator : "---" & return

tell application id "DNtp"
	-- set defaults
	set thePage to ""
	set theName to ""
	set theRefURL to ""
	set displayPage to ""
	set theSelectedText to ""
	set theLink to ""
	-- prompt for name of note and paragraph or page reference of source
	set theInbox to (incoming group of the current database)
	set theSubject to text returned of (display dialog "Can be the name of the document or a proposition for the note" with title "Enter the name of the note" default answer theName)
	-- get page link if selected
	if not (exists think window 1) then
		set noteVariation to "A"
		set theWindow to think window 1
		set noteVariation to "B"
	end if
	if noteVariation is "B" then
		set thisRecord to content record of theWindow
		if thisRecord ≠ missing value then
			set theType to (type of thisRecord) as string
				set theSelectedText to selected text of theWindow & "" as string
			on error
				display notification "No text selected"
				set theSelectedText to ""
			end try
			if theType is in {"PDF document", "«constant ****pdf »"} then
				set thePage to current page of theWindow
				set theRefURL to reference URL of thisRecord & "?page=" & thePage
				set theRefURL to reference URL of thisRecord
			end if
			set displayPage to ((thePage as integer) + 1)
			set theName to the name of thisRecord
			display dialog "Enter page & paragraph no (if required, otherwise leave blank)" default answer ", p " & displayPage & " "
			set page_and_paraRef to the text returned of the result
			set theLink to ("[" & theName & "](" & theRefURL & ")" & page_and_paraRef)
		end if
	end if
	if theSelectedText is "" then
		set theContent to ""
		set theContent to theDelimiter & theSelectedText
	end if
	--set theLocation to display group selector "Destination" buttons {"Cancel", "OK"}
	set theLocation to display group selector "Destination" buttons {"Cancel", "OK"}
	set newNote to create record with {name:(theSubject), type:markdown, content:("# " & theSubject & theDelimiter & theLink & theContent)} in theLocation
		set newWindow to open window for record newNote
		set bounds of newWindow to {0, 0, 412, 1000}
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

1 Like