使用PdfStamper如何使用itext将合并的PDF保存在文件夹下,然后读取它

时间:2011-08-15 14:29:47

标签: pdf itext

我需要将合并后的PDF保存在硬盘上,然后将其加载为最终PDF

下面是我的代码(在IPAD上使用Safri,PDF alwasy是空的)

            PdfReader reader = new PdfReader(folder + fileName);
            PdfStamper stamper = new PdfStamper( reader, out, '\0', true );
            AcroFields fields = stamper.getAcroFields();
            String fdfContent = (String) request.getAttribute("fdfContent");
            FdfReader fdfReader = new FdfReader(fdfContent.getBytes());
            fields.setFields(fdfReader);
            out.flush();
            stamper.close();
            reader.close();

非常感谢

1 个答案:

答案 0 :(得分:1)

使用

PdfStamper stamper = new PdfStamper( reader, out, '\0', false );
stamper.setFormFlattening(true);