I didn't understand if you're working with forms or just using the filed positions to place text. If you are working with forms and have auto-size the moment you edit the text field in Acrobat the text will be as big as the one generated by iText. If you set the font size to some value based on the text you have, and change the field property, edition in Acrobat will retain the size and will look bad with longer or shorter text, if that's your criteria of good looks.
Paulo > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Andrew Smith > Sent: Wednesday, June 07, 2006 9:41 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] autosize fonts for form fields > > Actually - scratch that - this solution won't work for > text that is longer than the original form field. > > Will itext allow me to compute the proper font size > based on the height AND WIDTH of a rectangle? > > What classes/methods are available to help me compute > the width of a piece of text given a certain font > size? > > -a. > > --- Andrew Smith <[EMAIL PROTECTED]> wrote: > > > Sending to the list for archival purpsoses in case > > anyone is interested. > > > > The solution we used was to set the font size to 60 > > percent of the rectangle height and then set an > > extra > > top margin on the field equal to 40 percent of the > > rectangle height. This closely approximates the way > > Adobe Reader renders the autosize fields that we've > > looked at. > > > > -a. > > > > > > > > --- bruno <[EMAIL PROTECTED]> wrote: > > > > > Andrew Smith wrote: > > > > > > >Is there something in the itext api to mimic the > > > >autosize feature that Adobe Acrobat provides for > > > form > > > >fields? > > > > > > > > > > > Yes. If you set the fontsize to 0, the font-size > > > will be adjusted > > > automatically so that the text fits the text > > field. > > > AcroFields form = stamper.getAcroFields(); > > > form.setFieldProperty("field", "textsize", new > > > Float(0), null); > > > > > > >The problem I have is that my height is too > > large. > > > The > > > >fonts always appear too large on the resulting > > > form. > > > > > > > > > > > Oh, I don't know if this will be fixed by setting > > > the font-size to 0. > > > > > > >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? > > > > > > > There is a way to adjust the positioning of the > > > text, but it doesn't > > > scale the font.: form.setExtraMargin(3, 3); > > > br, > > > Bruno > > > > > > > > > _______________________________________________ > > > iText-questions mailing list > > > iText-questions@lists.sourceforge.net > > > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > > protection around > > http://mail.yahoo.com > > > > > > _______________________________________________ > > iText-questions mailing list > > iText-questions@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions