0

当我尝试执行以下代码时,它会将我抛出错误

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)是文本类型,但是当我为其设置一个值时,我会遇到上述错误

谢谢

4

1 回答 1

0

一旦我将我的pdfbox.1.7.1版本更新为pdfbox1.8.1.jar

于 2013-05-10T10:29:11.367 回答