I am using PDFBox and have the following code snippet, which is reading a PDF file and converting it to image (PNG). It is working well, the only problem is that it is completely losing the barcode value that is in the PDF file.
Does anyone know how to work around this with PDFBox? Is that even possible? Thanks.
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);