小编use*_*193的帖子

创建PDF/A-3:嵌入式文件应包含有效的Params密钥

我试图用itextpdf-5.4.5和itext-pdfa-5.4.5创建一个PDF/A-3.当我设置PdfFileSpecification时,我得到以下异常:

com.itextpdf.text.pdf.PdfAConformanceException: Embedded file shall contain valid Params key.
Run Code Online (Sandbox Code Playgroud)

这是我创建PdfDictionary的部分:

PdfDictionary params = new PdfDictionary();
params.put(PdfName.MODDATE, new PdfDate());
PdfFileSpecification fileSpec = PdfFileSpecification.fileEmbedded(
writer, "./src/main/resources/com/itextpdf/invoice.xml", "invoice.xml", null, false, "text/xml", params);
Run Code Online (Sandbox Code Playgroud)

我找到了检查发生的方法,但我没有找到任何解决方案:

com.itextpdf.text.pdf.internal.PdfA3Checker.checkEmbeddedFile

protected void checkEmbeddedFile(PdfDictionary embeddedFile) {
    PdfDictionary params = getDirectDictionary(embeddedFile.get(PdfName.PARAMS));
    if (params == null) {
        throw new PdfAConformanceException(embeddedFile, MessageLocalization.getComposedMessage("embedded.file.shall.contain.valid.params.key"));
    }
Run Code Online (Sandbox Code Playgroud)

任何的想法?先感谢您!

pdf itext

3
推荐指数
1
解决办法
1383
查看次数

标签 统计

itext ×1

pdf ×1