Skip to content

Commit

Permalink
Merge pull request #20 from mblink/pdfjs-v4
Browse files Browse the repository at this point in the history
upgrade pdfjs to version 4
  • Loading branch information
SuttonKyle authored Jun 7, 2024
2 parents 861a850 + 6cf9ab7 commit 3812d53
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion example/example.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { init } from '../dist/es2015';

init('http://localhost:8080/pdf.worker.min.js');
init('http://localhost:8080/pdf.worker.min.mjs');
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "document-viewer-ts",
"version": "0.7.1-legacy",
"version": "1.0.0-legacy",
"description": "PDF and MS Doc viewer written in TypeScript for React and vanilla JavaScript",
"main": "dist/lib/index.js",
"module": "dist/es2015/index.js",
Expand All @@ -13,8 +13,7 @@
"styles"
],
"scripts": {
"build": "npm run build-es2015 && npm run build-cjs",
"build-cjs": "tsc -p tsconfig.commonjs.json",
"build": "npm run build-es2015",
"build-es2015": "tsc -p tsconfig.json",
"build-example": "npm run build && tsc -p tsconfig.example.json && webpack",
"clean": "rimraf ./dist ./build",
Expand Down Expand Up @@ -68,7 +67,7 @@
"core-js": "~3.23.3",
"eslint": "~8.38.0",
"express": "^4.18.3",
"pdfjs-dist": "3.11.174",
"pdfjs-dist": "4.3.136",
"process": "~0.11.10",
"react": "^16.9.0",
"react-dom": "^16.9.0",
Expand Down
4 changes: 2 additions & 2 deletions src/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlobalWorkerOptions, PDFDocumentProxy, PDFPageProxy, PageViewport, getDocument, renderTextLayer } from 'pdfjs-dist/legacy/build/pdf';
import { GlobalWorkerOptions, PDFDocumentProxy, PDFPageProxy, PageViewport, getDocument, renderTextLayer } from 'pdfjs-dist/legacy/build/pdf.mjs';
import type { TextContent } from 'pdfjs-dist/types/src/display/api';

const chevronLeft = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16">
Expand Down Expand Up @@ -36,7 +36,7 @@ const scaleTextLayer = async (
textContentSource: textContent,
container: textLayerFragment,
viewport: vs
}).promise;
})?.promise;
textLayerDiv.appendChild(textLayerFragment);
};

Expand Down
7 changes: 0 additions & 7 deletions tsconfig.commonjs.json

This file was deleted.

1 change: 0 additions & 1 deletion tsconfig.example.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./build",
},
"include": [
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
process: 'process/browser.js',
}),
]
};

0 comments on commit 3812d53

Please sign in to comment.