Text selection "maps onto no character of its pages" on some PDFs – no highlight popup in Obsidian, but highlighting works in Zotero

ZotLit version

2.2.2-2.2.2

Host application versions

obsidian 1.14.5, Zotero 10, macOS 26.6

Obsidian debug info

SYSTEM INFO:
	Obsidian version: 1.14.5
	Installer version: 1.14.5
	Operating system: Darwin Kernel Version 25.6.0: Sat Jul 11 15:26:12 PDT 2026; root:xnu-12377.161.13~4/RELEASE_ARM64_T8142 25.6.0
	Login status: not logged in
	Language: zh
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: Minimal 9.1.4
	Snippets enabled: 2
	Restricted mode: off
	Plugins installed: 30
	Plugins enabled: 1
		1: ZotLit v2.2.2

RECOMMENDATIONS:
	Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Reproduces in a sandbox vault?

Haven’t tried yet

Steps to reproduce

  1. In Zotero, have a PDF attachment that can be highlighted normally in Zotero’s own reader.
  2. Open the same PDF in Obsidian through ZotLit.
  3. Select any text on any page.

Expected behavior

The ZotLit highlight popup appears after selecting text, and a highlight can be created.

Actual behavior

Text can be selected visually, but no popup appears and no highlight is created. This happens on all pages of the affected PDFs (not scanned documents). Other PDFs in the same library, including Chinese ones with similar paths, work normally.

The problem occurs in both setups:
(a) Minimal 9.1.4 theme with 2 CSS snippets enabled (see debug info above);
(b) default theme with all CSS snippets disabled, only ZotLit enabled, after a full restart of Obsidian.

Also tried: re-exporting the PDF via macOS Preview and importing it as a separate item (still fails). The same files fail on both macOS and Windows.

Logs or screenshots

Failing PDF (Verbose level enabled in DevTools):
zotlit/obsidian/pdf-annotation-editor Text selection maps onto no character of its pages {pageIndexes: [0]}

Working PDF:
zotlit/obsidian/pdf-annotation-editor Mark Popup placed {action: ‘open’, kind: ‘create’, …}

In both cases the preceding logs are the same, including “Annotation marks rebuilt for a PDF view {annotations: 0, pages: 0}”, and the Zotero Local API connection works.

Thank you for the detailed report. The log line you found helps a lot.

When you select text, ZotLit matches the text you selected against the characters that Obsidian’s PDF engine reads from the page. For these PDFs, that match finds nothing, so ZotLit does not show the popup. Zotero reads the same file with its own PDF engine, so highlighting works there.

I cannot reproduce this with the PDFs I have. To find the cause, I need one of these two things:

Option 1 (best): the PDF file. Even one page of it is enough. You can attach it here, or send it to me privately if the paper is not public. It also helps to know where the file came from (publisher website, database, or a scanner or conversion app).

Option 2: a short check in DevTools. If you cannot share the file:

  1. Open one of the affected PDFs in Obsidian and click once inside the page.
  2. Open DevTools (Cmd+Option+I on macOS, Ctrl+Shift+I on Windows), then go to the Console tab.
  3. Paste the code below and press Enter.
  4. The result is copied to your clipboard. Paste it here in a reply.

The result includes the first few lines of text on page 1. You can remove them before you post, but please keep the numbers.

(async () => {
  const doc = app.workspace.activeLeaf?.view?.viewer?.child?.pdfViewer?.pdfDocument;
  if (!doc) return console.log("ZotLit check: click inside the PDF first, then run this again.");
  const meta = await doc.getMetadata();
  const page = await doc.getPage(1);
  const { items } = await page.getTextContent({ includeChars: true });
  const text = items.filter((i) => i.str?.trim());
  const report = {
    producer: meta.info?.Producer,
    creator: meta.info?.Creator,
    pageRotation: page.rotate,
    textItems: text.length,
    itemsWithChars: text.filter((i) => i.chars?.length).length,
    textLength: text.reduce((n, i) => n + i.str.replace(/\s/g, "").length, 0),
    charCount: text.reduce((n, i) => n + (i.chars ?? []).filter((c) => c.c.trim()).length, 0),
    samples: text.slice(0, 3).map((i) => ({
      str: i.str,
      chars: (i.chars ?? []).map((c) => c.c).join(""),
      transform: i.transform.map((n) => +n.toFixed(2)),
    })),
  };
  if (typeof copy === "function") copy(JSON.stringify(report, null, 2));
  console.log(report);
  return report;
})();

If you can, run it on one PDF that works too. Then I can compare the two results.

Thank you for the file and observation.

Custom CSS is not the cause (it reproduces without CSS); the file itself is. These PDFs store text inside reusable drawing blocks (“form objects”). Obsidian’s PDF engine does not report character positions inside them, while Zotero’s does. This prevents creating highlights, blocks editing Zotero highlights, and can cause wrong page labels (e.g. “2” instead of “130”). For now, please annotate these PDFs in Zotero.

For your other PDFs, run the DevTools snippet from this discussion; if itemsWithChars is smaller than textItems, it is the same cause.

We will maintain a fixed PDF engine in a separate companion plugin. This will take time. Track progress in #2033.

Marked as accepted answer on GitHub.

Thank you very much for your kind support. Looking forward to the new pdf
engine :slight_smile:

Aiden Liu @.***>于2026年11月15日 周日22:23写道:

Thank you for the file and observation.

Custom CSS is not the cause (it reproduces without CSS); the file itself
is. These PDFs store text inside reusable drawing blocks (“form objects”).
Obsidian’s PDF engine does not report character positions inside them,
while Zotero’s does. This prevents creating highlights, blocks editing
Zotero highlights, and can cause wrong page labels (e.g. “2” instead of
“130”). For now, please annotate these PDFs in Zotero.

For your other PDFs, run the DevTools snippet from this discussion; if
itemsWithChars is smaller than textItems, it is the same cause.

We will maintain a fixed PDF engine in a separate companion plugin. This
will take time. Track progress in #2033
https://github.com/aidenlx/zotlit/issues/2033.

—
Reply to this email directly, view it on GitHub
https://github.com/aidenlx/zotlit/discussions/1979?email_source=notifications&email_token=CFAG2T6MXDVQZGKFZVBAL6T5ZG355A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWGMZTCOJZUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-19633199,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/CFAG2T6HDROP4Z2Q6TQ2ATL5ZG355AVCNFSNUABIKJSXA33TNF2G64TZHM2DKNJZHAZTAMZSHNCGS43DOVZXG2LPNY5TCMJSG42DOMRTUF3AE
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
https://github.com/notifications/mobile/ios/CFAG2T2XJED6QDVZKOYTJBT5ZG355A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWGMZTCOJZUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM
and Android
https://github.com/notifications/mobile/android/CFAG2T5KCWPXIPL64ZQ32PL5ZG355A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWGMZTCOJZUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE.
Download it today!
You are receiving this because you authored the thread.Message ID:
@.***>

I’m seeing the same symptom on ZotLit 2.2.4 with another publicly available, original English PDF. Here is a sample you can use to reproduce it.

Environment: Obsidian 1.15.1, Zotero 10.0.9, macOS 27.2.1 (Apple Silicon). ZotLit is the only enabled community plugin in this vault.

Sample: Dong et al., APPL (ACL 2025), published PDF. https://aclanthology.org/2025.acl-long.63.pdf

  1. Add the PDF to Zotero and open it in Obsidian through ZotLit.
  2. On the first PDF page (printed page 1243), select text in the Abstract and release the mouse. I expect the annotation popup to appear, but it does not.
  3. Activate Highlight in the ZotLit toolbar and select text again. I expect a highlight to be created, but none appears.

I also saw the missing popup on a BabelDOC-generated Chinese–English copy of ReAct. In a controlled comparison on the same setup, I selected the same 30 characters in the first-page English abstract of both ReAct PDFs. Both produced a selection rectangle. The original English PDF opened the popup, and the bilingual copy did not. The Zotero local API returned HTTP 200 during that check.

I haven’t captured the per-character diagnostic for APPL, so the form-object cause described above is still unconfirmed for this sample. I hope the public PDF helps with the PDF engine work.