0
iText 7
을 사용하여 PDF에 양식을 추가하려고합니다.iText7 setValue 메서드가 작동하지 않습니다
필드의 값을 설정하려고 할 때 계속 오류가 발생합니다. 나는 addKid()
방법의 documentation에서 정보를 찾을 수 없었다. 누구든지이 오류를 해결하는 방법을 알고 있습니까? 여기
PdfException
당신이 점점 오류를 추정
PdfTextFormField confField = PdfFormField.createText(pdf);
confField.setFieldName(fieldName);
PdfWidgetAnnotation confCoverAnnot = new PdfWidgetAnnotation(new Rectangle(x, y, width, height));
PdfWidgetAnnotation confAnnot = new PdfWidgetAnnotation(new Rectangle(x2, y2, width2, height2));
for (int i = 1; i<= numPages; i++) {
switch(i) {
case 1:
pdf.getPage(i).addAnnotation(confCoverAnnot);
break;
default:
pdf.getPage(i).addAnnotation(confAnnot);
break;
}
}
/*
Trying to have two different annotations reference the same field value.
Upon using the `setValue()` method, I get: object.must.be.indirect.to.work.with.this.wrapper
Any way to get this to work properly?
*/
form.addField(confField);
confField.addKid(confCoverAnnot);
confField.addKid(confAnnot);
if (value.equals("") != true) {
confField.setValue(value); //error here
}
설명해 주셔서 감사합니다. 지금은 의미가 있습니다 :) – Elliot