How do I use new JBIG2 compression options in PDFNet?

Q: I noticed that the latest version of PDFNet includes improved JBIG2
compression and some new compression options. How do I use these
paramaters?

Also what can I do to speed-up compression at the expense of
compression ratio?
-----
A: In PDFNet v4.5 we added two options ('Threshold' and 'SharePages')
to control the compression algorithm:

[/JBIG2 /Threshold 0.6 /SharePages 10] - Compress a monochrome image
using JBIG2Decode compression with the given image threshold and by
sharing segments between a number of pages. The threshold is a
floating point number in the rage from 0 to 1. Increasing threshold
value will decrease the loss of image quality but may increase the
file size. The default value for threshold is 0.85. "SharePages"
parameter can be used to specify the maximum number of pages sharing a
common 'JBIG2Globals' segment stream. Increasing the value of this
parameter improves compression ratio at the expense of memory usage
and speed. A sample use case:

...
jbig2_hint = objset.CreateArray();
jbig2_hint.PushBackName("JBIG2");
jbig2_hint.PushBackName("Treshold");
jbig2_hint.PushBackNumber(0.8);
jbig2_hint.PushBackName("SharePages");
jbig2_hint.PushBackNumber(1);
...
Image img = Image.Create(doc, bmp, &jbig2_hint);

Please take a look at AddImage example (http://www.pdftron.com/pdfnet/
samplecode.html#AddImage) for a concrete sample code of how to create
the hint object and how to embed monochrome TIFF.

To speed up processing you may want to set "SharePages" to 1 - as
shown above.