document-viewer-ts
Advanced tools
Comparing version 0.6.1-legacy to 0.7.0-legacy
@@ -30,4 +30,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const vs = pdfPage.getViewport({ scale }); | ||
textLayerDiv.style.width = `${vs.width}px`; | ||
textLayerDiv.style.height = `${vs.height}px`; | ||
yield renderTextLayer({ | ||
@@ -84,3 +82,3 @@ textContentSource: textContent, | ||
const getZoomVal = (originalPageWidth) => { | ||
const pageWidth = containerDiv.offsetWidth * (parseInt(zoomSelect.value) / 100); | ||
const pageWidth = containerDiv.clientWidth * (parseInt(zoomSelect.value) / 100); | ||
const scaledBy = pageWidth / originalPageWidth; | ||
@@ -136,3 +134,3 @@ containerDiv.style.setProperty('--scale-factor', scaledBy.toString()); | ||
yield pdfPage.render({ | ||
canvasContext: ctx || {}, | ||
canvasContext: ctx || new CanvasRenderingContext2D(), | ||
viewport, | ||
@@ -192,2 +190,3 @@ }); | ||
yield displayPage(1); | ||
return; | ||
} | ||
@@ -223,2 +222,3 @@ catch (err) { | ||
try { | ||
containerDiv.innerHTML = ''; | ||
const documentUrl = containerDiv.getAttribute('data-document-url'); | ||
@@ -225,0 +225,0 @@ containerDiv.classList.add('document-viewer-ts'); |
@@ -33,4 +33,2 @@ "use strict"; | ||
const vs = pdfPage.getViewport({ scale }); | ||
textLayerDiv.style.width = `${vs.width}px`; | ||
textLayerDiv.style.height = `${vs.height}px`; | ||
yield (0, pdf_1.renderTextLayer)({ | ||
@@ -87,3 +85,3 @@ textContentSource: textContent, | ||
const getZoomVal = (originalPageWidth) => { | ||
const pageWidth = containerDiv.offsetWidth * (parseInt(zoomSelect.value) / 100); | ||
const pageWidth = containerDiv.clientWidth * (parseInt(zoomSelect.value) / 100); | ||
const scaledBy = pageWidth / originalPageWidth; | ||
@@ -139,3 +137,3 @@ containerDiv.style.setProperty('--scale-factor', scaledBy.toString()); | ||
yield pdfPage.render({ | ||
canvasContext: ctx || {}, | ||
canvasContext: ctx || new CanvasRenderingContext2D(), | ||
viewport, | ||
@@ -195,2 +193,3 @@ }); | ||
yield displayPage(1); | ||
return; | ||
} | ||
@@ -227,2 +226,3 @@ catch (err) { | ||
try { | ||
containerDiv.innerHTML = ''; | ||
const documentUrl = containerDiv.getAttribute('data-document-url'); | ||
@@ -229,0 +229,0 @@ containerDiv.classList.add('document-viewer-ts'); |
{ | ||
"name": "document-viewer-ts", | ||
"version": "0.6.1-legacy", | ||
"version": "0.7.0-legacy", | ||
"description": "PDF and MS Doc viewer written in TypeScript for React and vanilla JavaScript", | ||
@@ -21,11 +21,11 @@ "main": "dist/lib/index.js", | ||
"clean": "rimraf ./dist ./build", | ||
"lint:no-fix": "eslint --config='.eslintrc.js' './src/*.{ts,tsx}' './test/*.{ts,tsx}'", | ||
"lint:no-fix": "eslint --config='.eslintrc.js' './src/*.{ts,tsx}' './tests/*.{ts,tsx}'", | ||
"lint": "npm run lint:no-fix -- --fix", | ||
"prepublishOnly": "npm run clean && npm run build && npm run test -- --ci --silent && npm run lint:no-fix -- --max-warnings 0", | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
"serve-example": "npm run build-example && node server.js", | ||
"prepublishOnly": "npm run clean && npm run build && npm run test && npm run lint:no-fix -- --max-warnings 0", | ||
"test": "npx playwright test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/mblink/document-viewer.git" | ||
"url": "git+https://github.com/mblink/document-viewer-ts.git" | ||
}, | ||
@@ -54,10 +54,11 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/mblink/document-viewer/issues" | ||
"url": "https://github.com/mblink/document-viewer-ts/issues" | ||
}, | ||
"homepage": "https://github.com/mblink/document-viewer#readme", | ||
"homepage": "https://github.com/mblink/document-viewer-ts#readme", | ||
"devDependencies": { | ||
"@playwright/test": "^1.42.1", | ||
"@testing-library/react-hooks": "^7.0.2", | ||
"@types/eslint": "~8.37.0", | ||
"@types/estree": "^1.0.1", | ||
"@types/jest": "~29.5.1", | ||
"@types/node": "^20.11.30", | ||
"@types/react": "^16.8.0", | ||
@@ -71,6 +72,4 @@ "@types/react-dom": "^16.8.0", | ||
"eslint": "~8.38.0", | ||
"jest": "~29.5.0", | ||
"jest-canvas-mock": "^2.5.0", | ||
"jest-environment-jsdom": "~29.5.0", | ||
"pdfjs-dist": "~3.4.120", | ||
"express": "^4.18.3", | ||
"pdfjs-dist": "3.11.174", | ||
"process": "~0.11.10", | ||
@@ -81,6 +80,5 @@ "react": "^16.9.0", | ||
"smoothscroll-polyfill": "~0.4.4", | ||
"ts-jest": "~29.1.0", | ||
"ts-node": "~10.9.1", | ||
"typescript": "~5.0.4", | ||
"webpack": "~5.77.0", | ||
"webpack": "5.89.0", | ||
"webpack-cli": "~5.0.1" | ||
@@ -101,2 +99,2 @@ }, | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24
838
62132