Home > Net >  Itext7 PDF form fields assignment problem
Itext7 PDF form fields assignment problem

Time:09-20

Itext7 PDF template assignment, text fields, radio, multiple-choice is no problem, only the image domain, how couldn't assign an image, text'd be assigned in the image domain would ever be assignment images? Am I in the wrong direction?

CodePudding user response:

To solve the,,

CodePudding user response:

Have not used itext7, you can see the arc adobe PDF reader apis,

CodePudding user response:

Javax.xml.parsers. DocumentBuilderFactory. SetFeature (Ljava/lang/String; Z) V is excuse me this mistake how to solve the
Try {
Map Params=new HashMap<> (a);
Params. Put (" fill_15 ", "test");
PdfDocument PDF=new PdfDocument (new PdfReader (templatePath), new PdfWriter (newPDFPath));
If (params!=null & amp; & ! Params. IsEmpty ()) {//a parameter to replace
PdfAcroForm form=PdfAcroForm. GetAcroForm (PDF, true);
Map Fields=form. GetFormFields ();//get all form fields
For (String param: params keySet ()) {
PdfFormField formField=fields. The get (param);//get a certain form fields
If (formField!=null) {
//formField. SetFont (getDefaultFont ()). The setValue (params. Get (param));//replacement value

FormField. SetValue (params. Get (param));//replacement value
}
}
//form. FlattenFields ();//locking form, don't let change
}
PDF. The close ();
} the catch (Exception e) {
e.printStackTrace();
}


Com. Itextpdf
Itext7 - core
7.1.4 & lt;/version>
Pom

  • Related