2016-12-20 6 views
0

私の英語のために申し訳ありません.... sluduyuschyコードを使用して、いくつかの文字の組み合わせで埋められたフィールドをPDF文書に追加しますが、 Adoberのリーダーからそれをクリックするか、Adobe Readerからもう一度入力してください。私はそれは私が間違ってAcroForm櫛Itextpdf7のTextField

public class TestClass { 
public static void main(String[] args) throws IOException { 
    PdfWriter writer = new PdfWriter("D:\\TestPdf.pdf"); 
    PdfDocument pdf = new PdfDocument(writer); 
    PdfAcroForm myAcro = PdfAcroForm.getAcroForm(pdf,true); 
    pdf.addNewPage(); 
    PdfFormField text = PdfFormField.createText(pdf,new Rectangle(0f,800f,200f,50f),"textValue","") 
      .setFileSelect(false) //Meaningful only if the MaxLen entry is present in the text field dictionary and if the Multiline, Password, and FileSelect flags are clear. If true, the field is automatically divided into as many equally spaced positions, or combs, as the value of MaxLen, and the text is laid out into those combs. 
      .setMultiline(false) 
      .setPassword(false)  
      .setMaxLen(5) 
      .setComb(true); 


    text.setValue("What not good!"); 
    text.regenerateField(); 
    myAcro.addField(text); 
    pdf.close(); 
} 

答えて

0

何をやっている enter image description here良い参照]をクリックした場合にのみ、enter image description hereとして参照 は、それが働いた​​

+0

を設定してみてください。どうもありがとうございました。私はどれくらいの苦しみを抱いていたのですか。 –