Inconsistent links for selected text in PDFs between DT 3.9.1 and DTTG 3.7.1

Dear community, dear developers of DT3 and DTTG

I want to reference selected text in PDFs that are stored in synced databases of DT3 and DTTG. I like to export these (deep)links to markdown notes in obsidian.
I just discovered that the (deep)links that are created by DT3 with the popup-option “copy selection link” and with DTTG are not the same:
An example from the same document with same text selection:

DTTG:
x-devonthink-item://F3956B15-B6C0-45C2-95B0-5881828C36BF?page=0&istart=255&ilength=8&search=Reduction

DT3:
x-devonthink-item://F3956B15-B6C0-45C2-95B0-5881828C36BF?page=0&start=157&length=9&search=Reduction

Is this a bug?
It would be great if i could generate links to selected text in PDFs from my iPad and use it on my Mac afterwards.
Would this made possible in future updates?

Cheers from Hamburg
Jan

No, this is not a bug. There are two different frameworks involved and they both handle the structure of a page differently. That being said, the links should function the same on both platforms. That’s what we’ve seen in all our testing and no one has recently reported it not working.

Dear Jim,

thanks for the quick reply. Maybe it´s me first reporting that the links are not functioning the same.

Here is my example: take the DTTG 3.7.1 Manual https://download.devontechnologies.com/download/devonthink%20to%20go/3.7.1/DEVONthink%20To%20Go%20Manual.pdf

When I generate a link to page 2 of the manual (the directory) by selecting the SECOND occurrence of the sentence “create new items” (referring to page 19 of the manual) and hit “copy selection link”, the link I receive works fine in DT3 BUT in DTTG it jumps to the FIRST occurrence of the search string “create new items” (referring to page 13) and the same problem vice versa when I generate the link in DTTG and use it in DT3.

I presume, the URL parameters “&start=” and “&length” as well as “&istart=” and “&ilength” are not working on both platforms, therefore “just” the “&search=” parameter is used which then finds just the first occurrence of the search string but not the intended text selection on the page.

An there is even a second reason, why a link to a text selection generated in DTTG doesn´t work in DT3:
In DTTG the “&search=” parameter gets “double url-encoded”: in my example: “&search=Create%2520New%2520Items” instead of “&search=Create%20New%20Items”

This means, when the selected text (in DTTG) has space between characters (as in my example), DT3 cannot find the text string and is just jumping to the page but not to the text selection.

I have filed an issue on this.
Development will have to assess this behavior.

This is indeed intentional. Some parameters (start/length, istart/ilength) depend on the used PDF engine (PDFKit vs. PSPDFKit), others (page & search) are generic and used as a fallback and therefore the links should usually work on both platforms (at least as long as the selection is not limited to a word occurring multiple times).

One workaround is to use a longer & unique selection. Or highlight the selection and then link to the highlight annotation.