PDFBox - PDF to Image loss barcode

I use PDFBox and have the following code snippet that reads a PDF file and converts it to an image (PNG). It works well, the only problem is that it will completely lose the barcode value that is in the PDF file.

Does anyone know how to get around this with PDFBox? Is it possible? Thank.

PDDocument doc = PDDocument.load(new File("INPUT.pdf")); PDPage page = (PDPage) doc.getDocumentCatalog().getAllPages().get(0); BufferedImage image = page.convertToImage(); File outputfile = new File("image.png"); ImageIO.write(image, "png", outputfile); 
+1
image pdfbox barcode
Feb 25 '14 at 23:23
source share
1 answer

The barcode image is in a format that is not recognized in pdfbox. You are missing some additional extensions like these:

  • Reading JBIG2 Images: JBIG2 ImageIO or JBIG2-Image-Decoder
  • Reading JPEG 2000 Images (JPX): Basic JAI Image I / O Tools

More info here .

0
Nov 16 '16 at 8:58
source share



All Articles