我无法在pdf中写入具体位置

时间:2015-08-13 20:36:22

标签: eclipse jdbc itext

尝试使用pdfstamper来操作pdf我不知道代码中有什么错误,它不会在输出文件中打印文本字段。提前致谢

PdfReader reader = new PdfReader("Players.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(Result));
AcroFields form = stamper.getAcroFields(); // using acro fields to fill out the pdf
form.setGenerateAppearances(true);
rs = statement.executeQuery("SELECT * from Players");
while ( rs.next() ) {
     String Country = null;
     Country = rs.getString("CName");
     System.out.println(Country);
     if (rs != null)
        Country = rs.getString("CName");
     form.setField("Country",Country);
}

stamper.setFormFlattening(true);
stamper.close();
connection.close();

0 个答案:

没有答案