【发布时间】:2021-02-11 21:38:27
【问题描述】:
我的代码正在运行,但我在控制台上收到此警告消息:
“从 /Names 字典中删除 /IDTree,不属于那里”
我刚刚搜索过它,但我没有找到任何东西。 有人知道导致此警告消息的原因吗?
我的代码:
public static void abrirArquivoZipPdfCompleto(HttpServletResponse response, String fileName, List<ByteArrayInputStream[]> conteudosZIP)
throws Exception {
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName.replaceAll("\u0020", "_").replaceAll(",", "_") + ".zip");
ServletOutputStream out = response.getOutputStream();
ZipOutputStream zout = new ZipOutputStream(out);
Integer cont = 1;
for(ByteArrayInputStream[] conteudoArray : conteudosZIP ) {
try(PDDocument result = new PDDocument()){
PDFMergerUtility ut = new PDFMergerUtility();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
for(ByteArrayInputStream conteudo : conteudoArray) {
try (PDDocument conteudoPDDocument = PDDocument.load(conteudo)){
ut.appendDocument(result, conteudoPDDocument);
}finally {
conteudo.close();
}
}
result.save(byteArrayOutputStream);
ZipEntry ze = new ZipEntry(fileName + '_' + cont++ + ".pdf");
zout.putNextEntry(ze);
zout.write(byteArrayOutputStream.toByteArray());
zout.closeEntry();
byteArrayOutputStream.close();
}
}
zout.close();
out.close();
FacesContext.getCurrentInstance().getRenderResponse();
FacesContext.getCurrentInstance().responseComplete();
}
【问题讨论】:
-
它是无害的,它是关于结构树的一个元素在错误的位置。但是,我查看了源代码,似乎即使那里没有 IDTree,警告也已完成。你能分享你的文件吗?
-
固定在 issues.apache.org/jira/browse/PDFBOX-5100 中。如果可能的话,我还是想看看你的文件。
-
嗨@TilmanHausherr,你可以在这里看到生成的文件。 drive.google.com/drive/folders/…
-
谢谢,在错误的地方肯定没有 IDTree。我将在答案中总结我的 cmets。