Is there something in the itext api to mimic the
autosize feature that Adobe Acrobat provides for form
fields? 

I have a form that I am trying to fill out and the
fields have been set to "autosize" using Acrobat. If I
provide the data via xfdf the fonts for each field are
sized nicely and the form looks good. 

When I try to complete the form using itext my results
are not so good. My approach was to do something like
this:


PdfDictionary pdfDict = 
(PdfDictionary)formItem.widgets.get(0);
PdfArray fieldArr = (PdfArray)
pdfDict.get(PdfName.RECT);
Iterator rectIter =
fieldArr.getArrayList().iterator();
float llx = ((PdfNumber)rectIter.next()).floatValue();
float lly = ((PdfNumber)rectIter.next()).floatValue();
float urx = ((PdfNumber)rectIter.next()).floatValue();
float ury = ((PdfNumber)rectIter.next()).floatValue();

float height = ury - lly;

formFields.setFieldProperty(fdfKey, "textsize", new
Float(height), null);
formFields.setField(fdfKey, (String)value);

The problem I have is that my height is too large. The
fonts always appear too large on the resulting form.
Any characters below or above the line like j's and
g's are especially problematic. Is there some constant
adjustment factor I need to scale my font by? Is there
a better way to go about this?

Thanks.

-a. 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to