I have a PDF workflow where I take a base document with forms, then append a footer that puts values in the form fields and save the result, then open it with PDFBox and flatten it:
doc = PDDocument.load(tempFile); doc.getDocumentCatalog().getAcroForm().flatten(); Then I add an image to the page and save and close the doc: PDPage page = doc.getPage(0); PDImageXObject image = LosslessFactory.createFromImage(doc, toBufferedImage(generateBarcode("PC"+pcId))); PDPageContentStream contentStream = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.APPEND, true); contentStream.drawImage(image, 246, 36 ); contentStream.close(); doc.save(tempFile); doc.close(); Finally, I print it from the command line. With PDFBox 2.0.5 the resulting document prints fine. I'm using this command on macOS: /usr/bin/lpr -P TestPrinter -o InputSlot=Tray2 file.pdf With PDFBox 2.0.11 when I do the same, the form fields all come through as empty on the printout. (They do appear when I open the doc in Preview.) I don't really know why; I just tried updating to the latest on a lark. It feels like the flattening failed on 2.0.11. The printer is a bit dated and I think I went with flattening in the first place because that was the only way to get the doc to print correctly from the command line. I will stick with 2.0.5 for now because for this case it's critical that the printouts work. :) Thanks, Aaron Output from 2.0.5: http://opentools.org/files/print-job-2514255277731407198.pdf Output from 2.0.11: http://opentools.org/files/print-job-4933385101348305078.pdf --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org