diff --git a/main.ts b/main.ts index dcded65..3af0e10 100644 --- a/main.ts +++ b/main.ts @@ -1,7 +1,5 @@ -import {parseYaml, Plugin, TFile} from "obsidian"; +import {parseYaml, Plugin, loadPdfJs} from "obsidian"; import {BetterPdfSettings, BetterPdfSettingsTab} from "./settings"; -import * as pdfjs from "pdfjs-dist"; -import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.entry'; interface PdfNodeParameters { range: Array; @@ -23,8 +21,6 @@ export default class BetterPDFPlugin extends Plugin { this.settings = Object.assign(new BetterPdfSettings(), await this.loadData()); this.addSettingTab(new BetterPdfSettingsTab(this.app, this)); - pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker; - this.registerMarkdownCodeBlockProcessor("pdf", async (src, el, ctx) => { // Get Parameters let parameters: PdfNodeParameters | null = null; @@ -45,6 +41,7 @@ export default class BetterPDFPlugin extends Plugin { parameters.url = folderPath + "/" + parameters.url.substring(2, parameters.url.length); } //Read Document + const pdfjs = await loadPdfJs(); const arrayBuffer = await this.app.vault.adapter.readBinary(parameters.url); const buffer = new Uint8Array(arrayBuffer); const document = await pdfjs.getDocument(buffer).promise; diff --git a/manifest.json b/manifest.json index 540d73a..478d041 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "better-pdf-2", "name": "Better PDF 2", - "version": "2.0.2", + "version": "2.0.3", "minAppVersion": "0.15.0", "description": "Goal of this Plugin in to implement a native PDF handling workflow", "author": "JoLeaf", diff --git a/package.json b/package.json index 8b20317..82813fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-pdf-2", - "version": "2.0.2", + "version": "2.0.3", "description": "Goal of this Plugin in to implement a native PDF handling workflow", "main": "main.js", "scripts": { @@ -22,7 +22,6 @@ "typescript": "4.7.4" }, "dependencies": { - "canvas": "^2.11.2", - "pdfjs-dist": "^2.16.105" + "canvas": "^2.11.2" } } diff --git a/typings/index.d.ts b/typings/index.d.ts deleted file mode 100644 index e1c9a55..0000000 --- a/typings/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'pdfjs-dist/build/pdf.worker.entry'; \ No newline at end of file