You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by vivek <vi...@dcis.net> on 2011/12/07 20:06:26 UTC

Any way out for changing text font size dynamically

Hi All,

I need to change the text font size dynamically inside a text field - 
let's say if text doesn't fit into a text field, I want to reduce the 
font size until it gets fit into given text box.

I think I need to change appearance string of text field. But my problem 
is, da (default appearance) of PDVariableText is a private variable 
without any setter method. And I can't change str (which is actual 
appearance string ) of COSString as well.

Can I achieve this without changing source code?


--
Thanks
Vivek Saini



Re: Any way out for changing text font size dynamically

Posted by Gilad Denneboom <gi...@gmail.com>.
Are you talking about text inside a form text field? If so, just set the
font size to 0, which means it will automatically fit the size of the box.

On Wed, Dec 7, 2011 at 8:06 PM, vivek <vi...@dcis.net> wrote:

> Hi All,
>
> I need to change the text font size dynamically inside a text field -
> let's say if text doesn't fit into a text field, I want to reduce the font
> size until it gets fit into given text box.
>
> I think I need to change appearance string of text field. But my problem
> is, da (default appearance) of PDVariableText is a private variable without
> any setter method. And I can't change str (which is actual appearance
> string ) of COSString as well.
>
> Can I achieve this without changing source code?
>
>
> --
> Thanks
> Vivek Saini
>
>
>