Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PDF Plugin (@lapis-notes/pdf)

Source: packages/plugins/plugin-pdf/src/

Package: @lapis-notes/pdf. Manifest id: lapis-pdf.

The PDF package owns registry-installable PDF viewing for .pdf files plus PDF-specific embed rendering for markdown note embeds. The package remains in the monorepo for building official release artifacts, but the workspace no longer bundles or registers it by default.

Registration

  • View type: pdf
  • Official registry identity: lapis-pdf
  • Install location: /.obsidian/plugins/lapis-pdf; listed under Core plugins when installed provenance is official
  • File association: .pdf

Current Functionality

  • Ships the first-party plugin package and manifest for official registry installation.
  • Registers a dedicated file-backed PDF leaf instead of falling back to a text editor.
  • Requests PDF file resources through Vault.getResourceUrl() and mounts an EmbedPDF-backed viewer inside plugin-owned chrome.
  • Reuses the same viewer runtime for markdown ![[file.pdf]] embeds by registering a PDF embed renderer through the app embed registry.
  • Loads the heavy EmbedPDF runtime lazily from the plugin package so core-plugin registration does not eagerly pay the PDF engine startup cost.
  • Gives the EmbedPDF mount target an explicit, observed pixel height from its plugin-owned host so EmbedPDF’s shadow-DOM layout can render the document pages instead of measuring only its toolbar chrome.
  • Persists PDF viewer defaults through external plugin data under /.obsidian/plugins/lapis-pdf/data.json, with canonical plugin data mirrored through app configuration.
  • Exposes plugin settings for default zoom, scroll direction, page gap, and an optional dark-mode page inversion filter; the built-in default zoom is fit width so opened PDFs use the available pane width before any user zoom change.
  • Subscribes to EmbedPDF viewer state and writes viewer zoom/layout changes back into the plugin settings data so reloads reuse the last chosen viewer defaults.
  • Initializes EmbedPDF theme preference from the current Lapis app theme instead of OS-level system theme and updates open viewers when the app toggles between theme-dark and theme-light.
  • Disables EmbedPDF’s built-in document-open and document-close actions so the viewer stays scoped to the Lapis-owned file or embed source instead of opening a replacement browser file picker flow inside the viewer.
  • Exposes the dark-page inversion option in the PDF settings tab and in the PDF pane menu for file-backed views.
  • Applies the dark-page inversion filter only while the app is in dark mode, preferring page-image styling inside EmbedPDF’s shadow root and falling back to a scoped host-level filter only when shadow-root injection is unavailable.
  • Maps Lapis PDF theme tokens onto EmbedPDF’s --ep-* theme variables so toolbar chrome, overlays, inputs, borders, tooltips, and status colors inherit the active app theme instead of EmbedPDF’s stock dark/light palette.
  • Leaves file naming to workspace tab/header chrome and keeps the PDF leaf body focused on status messages plus the viewer surface.
  • Emits dist/app.css for workspace loading and dist/styles.css for standalone/plugin-local CSS consumption.
  • Namespaces plugin-owned chrome under pdf-... selectors so file views and inline embeds stay within the package boundary.
  • Uses --pdf-... theme variables to map PDF shell, surface, elevated/overlay/input backgrounds, borders, text, state colors, accent states, focus rings, tooltips, and EmbedPDF runtime chrome back to the shared workspace theme tokens.

Package Boundary

The plugin owns PDF-specific file views, renderer-provider integration, and PDF embed rendering. Generic file-view lifecycle, plugin activation, markdown post-processing hooks, and shared sanitization rules remain in @lapis-notes/api and the workspace shell unless PDF support proves they need an explicit contract extension.