@libresign/pdf-elements 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@libresign/pdf-elements",
3
3
  "description": "PDF viewer with draggable and resizable element overlays for Vue 2",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "author": "LibreCode <contact@librecode.coop>",
6
6
  "private": false,
7
7
  "main": "dist/pdf-elements.umd.js",
@@ -294,6 +294,11 @@ export default {
294
294
  this.selectedDocIndex = 0
295
295
  this.selectedPageIndex = 0
296
296
  this.$emit('pdf-elements:end-init', { docsCount: docs.length })
297
+ this.$nextTick(() => {
298
+ if (this.autoFitZoom) {
299
+ this.adjustZoomToFit()
300
+ }
301
+ })
297
302
  }
298
303
  },
299
304
 
@@ -835,6 +840,10 @@ export default {
835
840
  if (Math.abs(optimalScale - this.scale) > 0.01) {
836
841
  this.scale = optimalScale
837
842
  this.visualScale = optimalScale
843
+ this.pdfDocuments.forEach((doc) => {
844
+ doc.pagesScale = doc.pagesScale.map(() => this.scale)
845
+ })
846
+ this.cachePageBounds()
838
847
  }
839
848
  },
840
849
  },
package/src/index.js CHANGED
@@ -1,7 +1,13 @@
1
1
  // SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
 
4
+ import { GlobalWorkerOptions } from 'pdfjs-dist'
5
+ import pdfWorkerCode from 'pdfjs-dist/build/pdf.worker.min.mjs'
6
+
7
+ GlobalWorkerOptions.workerSrc = pdfWorkerCode
8
+
4
9
  import PDFElements from './components/PDFElements.vue'
10
+ export { setWorkerPath } from './utils/asyncReader.js'
5
11
 
6
12
  PDFElements.install = function(Vue) {
7
13
  if (PDFElements.install.installed) return
@@ -6,6 +6,10 @@ import pdfWorkerCode from 'pdfjs-dist/build/pdf.worker.min.mjs'
6
6
 
7
7
  GlobalWorkerOptions.workerSrc = pdfWorkerCode
8
8
 
9
+ export function setWorkerPath(path) {
10
+ GlobalWorkerOptions.workerSrc = path
11
+ }
12
+
9
13
  export function readAsArrayBuffer(file) {
10
14
  return new Promise((resolve, reject) => {
11
15
  const reader = new FileReader()