Repository navigation
fix(split): set the pdf.js wasmUrl so JPEG2000 images get drawn (#95) - #97
Merged
Merged
Conversation
Without wasmUrl OpenJPEG fails to initialize, and pdf.js carries on with a null image: pages holding JPX images came out blank with only a warning. - Point wasmUrl at pdfjs-dist/wasm and require openjpeg.wasm before rendering. - Unpack openjpeg.wasm and read it from app.asar.unpacked. Electron's existsSync answers from the archive's header for an app.asar path, so a file gone from the disk would still pass the check. - Add a full-page JPX page to the render sample. Also treat JpxImage# warnings as problems: with only the wasm gone, the JS fallback draws the same pixels. - Check the unpacked file in verify:package, on any host, and in the load check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #95
wasmUrl(指向pdfjs-dist/wasm/),打包后通过app.asar.unpacked真实路径读取;asarUnpack加入openjpeg.wasm。openjpeg.wasm纳入渲染前的必需文件检查;JpxImage#警告也视为渲染问题(否则 JS 回退会掩盖缺失)。scripts/unpacked-assets.cjs,verify-package-arch.mjs与package-load-check.cjs共用,检查 wasm 存在且魔数正确。pdf-render-check.pdf增加整页 JPX 图像页,断言暗像素 ≥ 90%(打包实测 38400/38400)。