From 6b54f395b0b9d29189fdf99cb2e84556c608686f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 29 May 2024 02:29:40 +0900 Subject: feat(blog/nuldoc): update PDF.js from 3.4.120 to 4.3.136 --- vhosts/blog/public/slide.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'vhosts/blog/public/slide.js') diff --git a/vhosts/blog/public/slide.js b/vhosts/blog/public/slide.js index 77e49acc..4c7a0de8 100644 --- a/vhosts/blog/public/slide.js +++ b/vhosts/blog/public/slide.js @@ -1,6 +1,7 @@ +import { GlobalWorkerOptions, getDocument } from "/pdf.min.mjs"; + document.addEventListener("DOMContentLoaded", async () => { - const pdfjsLib = globalThis.pdfjsLib; - pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.4.120/pdf.worker.min.js"; + GlobalWorkerOptions.workerSrc = "/pdf.worker.min.mjs"; const canvas = document.getElementById("slide"); const ctx = canvas.getContext("2d"); @@ -15,7 +16,7 @@ document.addEventListener("DOMContentLoaded", async () => { pageRendering = true; const page = await doc.getPage(num); - var viewport = page.getViewport({ scale: 1.0 }); + const viewport = page.getViewport({ scale: 1.0 }); canvas.height = viewport.height; canvas.width = viewport.width; @@ -54,6 +55,6 @@ document.addEventListener("DOMContentLoaded", async () => { }); // TODO: error handling - doc = await pdfjsLib.getDocument(url).promise; + doc = await getDocument(url).promise; queueRenderPage(pageNum); }); -- cgit v1.2.3-70-g09d2