JBIG2 is a mutlipage image format, but is different from - for example - multipage tiff
because the images are not independently compressed. They share compression
data, specifically a symbol dictionary.
There are three possible approaches here:
1. Have Tesseract accept JBIG2 images produced by jbig2enc and embed them
into PDF without modification,
2. Have Tesseract actually do JBIG2 compression.
3. Have Tesseract do image segmentation, compress some parts of the page
as JBIG2, other parts as JP2K, and store the results in PDF in a mixed raster
format.
I'm only going to discuss #1 because it is simplest and matches the current
'try to never transcode' philosophy. We'd need a JBIG2 decoder in Leptonica.
That's probably straightforward but still a very solid chunk of work.
Then, there is what to do in Tesseract. The PDF rendering module would need to learn
about the symbol dictionary (or dictionaries) and add it to collection of PDF objects.
It will need an understanding of what's going on much better than what we currently
use, which is simply 'Hey, what image file belongs to this page? Let's try to inline it
unchanged,'
Now the good news is the PDF rendering module is really small and is not cemented
down by a whole bunch of unnecessary abstraction layers. And I know it's possible
because I've personally done it with colleagues elsewhere.
But it is a pretty significant effort, and I'm honestly not sure it's worth putting inside
Tesseract. Maybe a better approach is post processing, with a PDF to PDF converter
that uses approach #3. This is the winning strategy for Linearization, which can be
done on a Tesseract produced PDF using QPDF.