Skip to content

Commit

Permalink
Update pdfjs-dist to 3.10.111
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Sep 22, 2023
1 parent 14dd149 commit 4275142
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/react-pdf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"make-cancellable-promise": "^1.3.1",
"make-event-props": "^1.6.0",
"merge-refs": "^1.2.1",
"pdfjs-dist": "3.8.162",
"pdfjs-dist": "3.10.111",
"prop-types": "^15.6.2",
"tiny-invariant": "^1.0.0",
"tiny-warning": "^1.0.0"
Expand Down
20 changes: 9 additions & 11 deletions packages/react-pdf/src/Page/PageSVG.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import usePageContext from '../shared/hooks/usePageContext.js';
import useResolver from '../shared/hooks/useResolver.js';
import { cancelRunningTask, isCancelException, makePageCallback } from '../shared/utils.js';

import type { PageViewport } from 'pdfjs-dist';
import type { PDFOperatorList } from 'pdfjs-dist/types/src/display/api.js';

type SVGGraphics = {
getSVG: (operatorList: PDFOperatorList, viewport: PageViewport) => Promise<SVGElement>;
};

export default function PageSVG() {
const pageContext = usePageContext();

Expand Down Expand Up @@ -81,20 +88,11 @@ export default function PageSVG() {

cancellable.promise
.then((operatorList) => {
if (!pdfjs.SVGGraphics) {
throw new Error('SVGGraphics is not supported.');
}

const svgGfx = new pdfjs.SVGGraphics(page.commonObjs, page.objs);
const svgGfx: SVGGraphics = new pdfjs.SVGGraphics(page.commonObjs, page.objs);

svgGfx
.getSVG(operatorList, viewport)
.then((nextSvg: unknown) => {
// See https://github.com/mozilla/pdf.js/issues/16745
if (!(nextSvg instanceof SVGElement)) {
throw new Error('getSVG returned unexpected result.');
}

.then((nextSvg) => {
svgDispatch({ type: 'RESOLVE', value: nextSvg });
})
.catch((error) => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-pdf/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"moduleResolution": "node",
"noUncheckedIndexedAccess": true,
"outDir": "dist",
"skipLibCheck": true,
"strict": true,
"target": "es2015"
},
Expand Down
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"moduleResolution": "node",
"noUncheckedIndexedAccess": true,
"outDir": "dist",
"skipLibCheck": true,
"strict": true,
"target": "es2015"
}
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5085,9 +5085,9 @@ __metadata:
languageName: node
linkType: hard

"pdfjs-dist@npm:3.8.162":
version: 3.8.162
resolution: "pdfjs-dist@npm:3.8.162"
"pdfjs-dist@npm:3.10.111":
version: 3.10.111
resolution: "pdfjs-dist@npm:3.10.111"
dependencies:
canvas: ^2.11.2
path2d-polyfill: ^2.0.1
Expand All @@ -5096,7 +5096,7 @@ __metadata:
optional: true
path2d-polyfill:
optional: true
checksum: 2d6449c45e5b5be37b11ac2cac393b465255437237c7d6f2e3482b6806a43acb33cd48864e13f2fed357df7cbc40b110ca427153e5192515bfac22d8a7839df0
checksum: 719eff6525765c65ea527d2dca9f1a79369c8cd75c5d73db2c0089e9ac2215139faff9249287181625e37aa5a0bd92cde613d877f02662930cac842133a8f4e6
languageName: node
linkType: hard

Expand Down Expand Up @@ -5314,7 +5314,7 @@ __metadata:
make-event-props: ^1.6.0
merge-refs: ^1.2.1
nodemon: ^3.0.0
pdfjs-dist: 3.8.162
pdfjs-dist: 3.10.111
prettier: ^2.7.0
prop-types: ^15.6.2
react: ^18.2.0
Expand Down

0 comments on commit 4275142

Please sign in to comment.