[英]PDFBOX : java.lang.NumberFormatException:
当我尝试执行以下代码时,将我抛出以下错误
java.lang.NumberFormatException: For input string: "8#40"
at java.lang.NumberFormatException.forInputString(Unknown Source)
代码:
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
public class PDFPerform
{
public static void main(String[] args)
{
try{
String sourcePath = "C:\\Users\\347702\\Desktop\\fw4.pdf";
String destinationPath = "D:\\PDF_FORMS\\filled_fw4.pdf";
PDDocument document;
document = PDDocument.load(sourcePath);
PDAcroForm form = document.getDocumentCatalog().getAcroForm();
PDField Field_1= form.getField("f1_09(0)");
Field_1.getValue();
System.out.println(Field_1.getValue());
Field_1.setValue("asdsd");
System.out.println(Field_1.getFieldType());
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
任何人都可以帮我解决上述问题的根本原因..所述字段f1_09(0)
的类型为text,但是当我将其设置为值时,会出现上述错误
谢谢
一旦我将pdfbox.1.7.1
版本更新为pdfbox1.8.1.jar
pdfbox.1.7.1
可以pdfbox1.8.1.jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.