Reputation: 1463
I'm using iTextSharp to populate the data to PDF Templates, which is created in OpenOffice. it populating fine, I'm getting proper PDF, but some where i want to increase the width of the AcroField.
I did below code. it is increasing the width but text is not displaying.
AcroFields.Item fldItem = fields.getFieldItem(fieldName);
for (int i =0; i < fldItem.size(); ++i) {
PdfDictionary widgetDict = fldItem.getWidget(0);
PdfArray rectArr = widgetDict.getAsArray(PdfName.RECT);
float origX = rectArr.getAsNumber(0).floatValue();
rectArr.set( 2, new PdfNumber( origX + 12 + 60 ) );
}
in the below image highlighted one. actual string is 10000 SUPERIOROPTICAL 123 4567 89
please help.
thanks.
Upvotes: 2
Views: 2113
Reputation: 77528
I can't reproduce the problem. I've made this POC: ChangeFieldSize
In this example, I take a form with three fields, among others a "Name"
and a "Company"
field. I first change the size of the "Name"
field, the same way you change the field. Then I fill out the "Name"
field and the "Company"
field. Note that the order in which I perform these operations is important. Maybe you're doing it the other way round.
The result looks like this:
As you can see, the text isn't truncated the way it is in your screen shot.
So there are two things you can try:
If that doesn't help, post a SSCCE.
Upvotes: 2