mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-05-31 07:11:00 +02:00
*Note:* This is similar to PR 19525, which did the same thing for the OpenJPEG decoder. The advantages of doing this are: - The same JBig2 decoder is used regardless of WASM being supported or not, which means consistent rendering. - The old `Jbig2Image` implementation has various bugs and missing features. - Less code that needs to be maintained in the PDF.js project, since both the CCITT and the JBig2 decoder is replaced. The disadvantage of doing this is: - Slightly larger bundle size, however the effect is limited since a fair amount of PDF.js code can be removed. For the `gulp mozcentral` target the size increase is approximately 54 kilo-bytes (which is small compared to the 452 kilo-bytes for the JS version of the OpenJPEG decoder).
Build
In order to generate the file jbig2.js:
- git clone https://github.com/mozilla/pdf.js.jbig2/
- the build requires to have a Docker setup and then:
node build.js -Cto build the Docker imagenode build.js -co /pdf.js/external/jbig2/to compile the decoder
Licensing
PDFium is under Apache-2.0
and pdf.js.jbig2 is released under Apache-2.0 license so jbig2.js is released under Apache-2.0 license too.