itext7 - creating textbox in iText 7 -


i trying create textbox using itext 7, , keep getting nullpointerexception when calling createtext method. haven't seen discussing kind of problem - assistance appreciated. line of code causes exception:

pdftextformfield textfield = pdfformfield.createtext(     doc,     new rectangle(         params.xfrom,          params.yfrom,         params.xtill,         params.ytill),     params.name); 

your code snippet doesn't tell doc or params about, have tested example official tutorial: c04e02_jobapplication.java, , executed without errors, resulting in following pdf file:

enter image description here

the createtext() method of pdftextformfield class used this:

pdftextformfield namefield = pdftextformfield.createtext(doc.getpdfdocument(),     new rectangle(99, 753, 425, 15), "name", ""); 

i tested variation:

pdftextformfield namefield = pdftextformfield.createtext(doc.getpdfdocument(),     new rectangle(99, 753, 425, 15), "name"); 

no exceptions thrown either.

summarized:

  • either there's problem doc or params, can't tell more that, because don't show got parameters,
  • or aren't using same itext 7 version using.

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -