Annotations vs Annotations?

From page 122 of the user guide (also available through the in-app Help):

Maybe that helps a little.

Stephen

2 Likes

:+1:t6:it does help. Thanks.

Thanks for this clarification, but let me add a little more, um, confusion. I would have called this original post “Annotations vs Annotations vs Annotations” since I see three types of annotations in the help files. Let me see if I can explain, and I’d appreciate some clarification if I’m incorrect:

  • First, there are Annotations(#1) below finder comments, that apply to the entire document (cali310 describes them as cliff notes).
  • Then there are Annotations(#2) in the document panel, that collect markup like highlighting, and provide link-backs. Devonthink 3 can also produce a list of all A#2 in a report for one or several documents, which is my main use.
  • Third, there are Annotations(#3) that you find by searching help, especially for DT2G, that simply refer to PDF markup, like highlighting.

Now, check me here, A#2 and A#3 may be the same thing, except DT2G can only do the document highlighting/markup part, and cannot access the DT3 #A1 or A#2 fields. But, highlighting in DT2G will show up in DT3 highlighting summary reports (and A#2 field?). If that’s all correct, my only remaining question is this: What lives in the remote annotations file, only A#1? The whole document notes? And Annotations like highlighting are just in the PDF and can be extracted via script. Right?

Have you used the Annotations file feature?
It is a separate document associated with the current document. It can contain notes, links, etc.

A2 and A3 are the same thing, however, you can annotate PDFs in both DEVONthihk and DEVONthink To Go. And those annotations sync between devices so they are accessible to both apps.

I have played around with adding file annotations, but the idea being able to mark up a pdf, in DT2G, even in an external app, and then (what’s the word?) transclude all the marked sections from several documents into a “notes” file is perfect for my workflow (educator). Am not sure I see the benefit of a document-wide annotation file.

Thanks for your support!

You’re welcome :slight_smile:

I know this is an old conversation but I found it very helpful for building the solution I wanted. There may be better ways to do this but I found if I adapted the existing Annotation.md template to have the record at the top as a header entry when I merge annotation files I can add TOC at the top and get a nice Table of Contents. I wanted to find a flexible way to pull summary notes together for multiple documents on the fly and be able to browse through. What I wish, but don’t have nearly enough knowledge to do, is that the TOC would manifest in the Markdown as well. It can be a pain having to go back and forth between the editor and the viewer. My template looks like:

%recordName%

Cues:

Summary:

Notes:

Type your note here.

On merge I add at the top of the document:

Table of Contents:

{{TOC}}

And voila!

1 Like

I would like to create a smart rule (or batch process) that 1) finds Notes in my custom metadata of PDFs and 2) moves each note to the Annotation field of the PDF, ideally using the default text template (with a backlink). Has anyone created or tried this? I am seeing something similar: https://discourse.devontechnologies.com/t/new-rtf-doc-from-selected-text-with-url-to-pdf/14512/1

Thanks!
Thanks!

While a smart rule should be able to find the notes, it’s not possible to automatically generate annotations. This would require a script.

As @cgrunenberg said: You’ll need to script that. I posted a script showing how to set annotations in PDFs via JavaScript here:

However,

Such a thing does not exist. Annotations are bound to pages in the PDF. You can, of course, decide to attach them all to the first page (or the last, or whatever), but the basic idea is that they refer to something in the PDF.

backlink to what?

Due to the description @zoepster seems to prefer the record’s annotation, see Annotations & Reminder inspector and its default text templates, not PDF annotations.

1 Like

The DT scripting dictionary knows an annotation which is a record. That probably indicates a DT record. So, I’d create a MD record (for example) from a template, copy the PDF’s Notes custom meta data field to that one, add the link to the PDF document to the MD text (or somewhere else?) and then set the annotation property of the PDF to this new MD document?

Exactly, that’s how it should work.

And would it be possible to access the annotation template (MD or plain text) somehow from the script? I didn’t really find anything in the scripting dictionary…

I came up with this JavaScript code that can be run from a smart rule.

function performsmartrule(records) {
  const app = Application("DEVONthink 3");
  const se = Application("System Events");
  /* Get the users full name from System Events */
  const userFullname = se.users[0].fullName();
  /* Loop over all records that are PDFs (filter rejects the others) */
  records.filter(r => r.type() === "PDF document").forEach(r => {
    /* get the annotation group for this record's database */
    const annotationGroup = r.database.annotationsGroup();
       /* Get the custom meta data "Notes". Only if it exists and is not empty, create the annotation */
	const notes = r.getCustomMetaData({for: "notes", from: r});
	if (notes && notes !== "") {
        /* Create a basic markdown record in the current record's annotation group */
    const annotation = app.createRecordWith({
	     type: "markdown",
	     name: `${r.name()} (Annotation)`},
		 {in: annotationGroup});
            /* Add the template data and the content of the Notes to this new record */
	annotation.plainText = `**Document**
[${r.name()}](x-devonthink-item:${r.uuid()})

**Date & Time**
${(new Date()).toLocaleString()}

**Annotator**
${userFullname}  

**Notes**
${notes}
`;
      /* Set the new record as annotation to the PDF */
       r.annotation = annotation;
    }
  })
}

Since I don’t know of a way to access the MD template for annotations directly, I (kind of) copied the text verbatim into the script. Kind of, because I’m running in a German locale, so the headings are different from what you probably want. But you can adjust the MD (and anything else, of course) to whatever you like.

No, that’s not possible.

Thank you! I do need the record annotation. I will read these responses very carefully and try them out. Many thanks for these pointers and the discussion. Apologies for any lack of clarity.

Backlink to the PDF.

I have read through all of this thread, though some of it is beyond my expertise level. My use case is that I’m looking to make notes on articles (a brief summary of the pertinent points of the article essentially). Where would I be best to input that text? I’m guessing in the “annotations” box of the “annotations & reminders” section of the inspector pane - though am happy to be corrected if there is a more suitable method. Thanks!

Yes, using an annotation file is a commonly used way to take such notes.

1 Like