0
我需要在内存中创建PDF文档我正在使用pdfbox。在内存中创建pdf文档
这是我的代码,但它在磁盘上创建文档。
public PDDocument generatePDF(String name, String v1, String v2, String v3, String v4) {
PDPageContentStream contentStream = null;
PDDocument document = null;
try {
document = new PDDocument();
PDPage page = new PDPage();
document.addPage(page);
contentStream = new PDPageContentStream(document, page);
fillDataInPDF(...);
corpPDF(page);
} catch (IOException err) {
LOG.error("Error occured .");
} finally {
if (contentStream != null) {
try {
contentStream.close();
} catch (IOException e) {
LOG.error("Error occured .");
}
}
}
return document;
}
好的。我赞同你在记忆中创造它的欲望。你真的做到了,或做了一些没有用的东西? –
我已经创建了磁盘,不知道如何在内存中继续。 – singhal
您的代码示例中没有任何内容会暗示它是在光盘上创建的。 –