Java port of jbig2enc pdf.py script