moshensky / pdf-visual-diff

Visual Regression Testing for PDFs in JavaScript
MIT License
43 stars 18 forks source link

Fixed pdfjs cmaps path resolution #50

Closed krml4913 closed 1 year ago

krml4913 commented 1 year ago

I use pdf-visual-diff in my repo and got the following error.

node ➜ /workspaces/pdf-test (master) $ yarn ts-node index.ts 
yarn run v1.22.19
$ /workspaces/pdf-test/node_modules/.bin/ts-node index.ts
Warning: loadFont - translateFont failed: "UnknownErrorException: Unable to load binary CMap at: /workspaces/pdf-test/node_modules/pdf-visual-diff/node_modules/pdfjs-dist/cmaps/Adobe-Japan1-UCS2.bcmap".
Warning: Error during font loading: Unable to load binary CMap at: /workspaces/pdf-test/node_modules/pdf-visual-diff/node_modules/pdfjs-dist/cmaps/Adobe-Japan1-UCS2.bcmap
Warning: loadFont - translateFont failed: "UnknownErrorException: Unable to load binary CMap at: /workspaces/pdf-test/node_modules/pdf-visual-diff/node_modules/pdfjs-dist/cmaps/Adobe-Japan1-UCS2.bcmap".
Warning: Error during font loading: Unable to load binary CMap at: /workspaces/pdf-test/node_modules/pdf-visual-diff/node_modules/pdfjs-dist/cmaps/Adobe-Japan1-UCS2.bcmap

The correct cmaps path is \ /workspaces/pdf-test/node_modules/pdfjs-dist/cmaps/Adobe-Japan1-UCS2.bcmap but \ /workspaces/pdf-test/node_modules/pdf-visual-diff/node_modules/pdfjs-dist/cmaps/Adobe-Japan1-UCS2.bcmap \ (/workspaces/pdf-test is base dir of my repo.)

This PR fixes pdfjs-dist path resolution.

krml4913 commented 1 year ago

@moshensky Hi. Please review this PR when you have time.

moshensky commented 1 year ago

@krml4913 I took the liberty to merge your PR. I have released 0.7.1 with your fix. Thank you :)