【发布时间】:2012-07-21 14:44:04
【问题描述】:
我目前正在使用 PdfBox 作为 pdf 文件编辑器应用程序的驱动程序。 我需要将 pdf 文件 (PDDocument) 的 PdfBox 表示的内容作为字节数组。 有谁知道怎么做?
【问题讨论】:
-
你发现了吗?我也想知道...
我目前正在使用 PdfBox 作为 pdf 文件编辑器应用程序的驱动程序。 我需要将 pdf 文件 (PDDocument) 的 PdfBox 表示的内容作为字节数组。 有谁知道怎么做?
【问题讨论】:
希望还不算太晚……
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
document.save(byteArrayOutputStream);
document.close();
InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
瞧!你有两个输入流!
【讨论】: