我正在使用Apache PdfBox预设几种非PDF / A表单,并使用PDFMergerUtility
将这些PDF合并在一起,并创建新PDF的字节数组。
PDFMergerUtility mergerUtility = new PDFMergerUtility();
// presetting forms of these PDFs is omitted for readability
mergerUtility.addSource(new File("a.pdf"));
mergerUtility.addSource(new File("b.pdf"));
mergerUtility.addSource(new File("c.pdf"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
mergerUtility.setDestinationStream(outputStream);
try {
mergerUtility.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
return outputStream.toByteArray();
} catch (IOException ex) {
log.error("Unable to merge documents", ex);
throw new RuntimeException("Unable to merge", ex);
}
有没有办法告诉PDFMergerUtility
创建无法再修改的有效PDF / A文档?