I am currently using PdfBox as the driver for a pdf-file editor application. I need the contents of the PdfBox representation of a pdf file (PDDocument) as a byte array. Does anyone know how to do this?
I hope it's not too late...
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
document.save(byteArrayOutputStream);
document.close();
InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
And voila! You've got both input streams!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.