List of usage examples for org.apache.pdfbox.filter JBIG2Filter JBIG2Filter
JBIG2Filter
From source file:com.pnf.plugin.pdf.filter.JBIG2Decode.java
License:Apache License
public byte[] decodeBytes(byte[] data, int fromByte, int length, PdfDictionary dictionary) throws FilterStreamException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayInputStream bais = new ByteArrayInputStream(data, fromByte, length); try {// w w w .ja v a 2 s . c om new JBIG2Filter().decode(bais, baos, PDFObject.getInstance(dictionary), PDFObject.getInstance(decodeParms)); return baos.toByteArray(); // https://github.com/katjas/PDFrenderer fork of pdf-renderer use jpedal where license seems commercial // return new JBig2Decode().decode(PDFObject.getInstance(decodeParms), // ByteBufferUtils.getByteArray(data, fromByte, length).toByteArray()); } catch (IOException e) { throw new FilterStreamException(e); } }