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:
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
orparams
, can't tell more that, because don't show got parameters, - or aren't using same itext 7 version using.
Comments
Post a Comment