generated from RyotaUshio/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 25
For developers
Ryota Ushio edited this page Feb 3, 2024
·
11 revisions
PDF++ exposes the plugin (PDFPlus
) instance as the pdfPlus
global variable.
It has several methods to interact from the dev console:
-
getPDFDocument
: get the reference to PDF.js'sPDFDocumentProxy
object -
getPage
: get the reference to PDF.js'sPDFPageProxy
object -
getPDFView
: get Obsidian's native PDF view -
getPDFViewer
: getPDFViewer
instance (see typings.d.ts) -
getPDFViewerChild
: getPDFViewerChild
instance (see typings.d.ts) -
getObsidianViewer
: getObsidianViewer
instance (see typings.d.ts) -
getRawPDFViewer
: getRawPDFViewer
instance (see typings.d.ts) -
getToolbar
: getPDFToolbar
instance (see typings.d.ts)
// in the dev console
const pageNumber = 2 // 1-based
const annotationId = '1251R' // the string you get when copying a link to the annotation
const annot = pdfPlus.getPDFViewerChild().getPage(pageNumber).annotationLayer.annotationLayer.getAnnotation(annotationId);
console.log(annot)
console.log(annot.data)
- The PDF specification.
- pdfAnnotate's README is a great resource for how PDFs work. Especially, it mentions an error in the PDF specification, which was very helpful.
- Mozilla PDF.js's recommendations: https://github.com/mozilla/pdf.js?tab=readme-ov-file#learning