You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Lorena Leishman <lo...@yahoo.com.INVALID> on 2015/03/05 19:37:10 UTC

changing font type

Hi everyone,
I have this acroform with let's say 100 fields. I want to change the font type of only one of these fields and leave the rest alone. I know the field name. Is there some reliable example code you know of that might performed this task?
I have tried different examples I found online with no success. Any help will be appreciated. 
Thanks!
Lorena

Re: changing font type

Posted by John Hewson <jo...@jahewson.com>.
Which font do you want to use for that one field? Are you after a specific font or just a font size or style (e.g. sans serif?)?

— John

> On 6 Mar 2015, at 03:17, Gilad Denneboom <gi...@gmail.com> wrote:
> 
> It's a bit tricky... One way of doing it would be to get the COSDictionary
> property of the PDField object and then edit the Default Appearance string
> directly. You would need to know the internal name for the font you want to
> use, though.
> See this question for some more information on a similar subject:
> http://stackoverflow.com/questions/23501637/set-a-pdfformfields-value-with-a-specific-font-size
> 
> On Thu, Mar 5, 2015 at 7:37 PM, Lorena Leishman <
> lorenaleishman@yahoo.com.invalid> wrote:
> 
>> Hi everyone,
>> I have this acroform with let's say 100 fields. I want to change the font
>> type of only one of these fields and leave the rest alone. I know the field
>> name. Is there some reliable example code you know of that might performed
>> this task?
>> I have tried different examples I found online with no success. Any help
>> will be appreciated.
>> Thanks!
>> Lorena


Re: changing font type

Posted by Gilad Denneboom <gi...@gmail.com>.
It's a bit tricky... One way of doing it would be to get the COSDictionary
property of the PDField object and then edit the Default Appearance string
directly. You would need to know the internal name for the font you want to
use, though.
See this question for some more information on a similar subject:
http://stackoverflow.com/questions/23501637/set-a-pdfformfields-value-with-a-specific-font-size

On Thu, Mar 5, 2015 at 7:37 PM, Lorena Leishman <
lorenaleishman@yahoo.com.invalid> wrote:

> Hi everyone,
> I have this acroform with let's say 100 fields. I want to change the font
> type of only one of these fields and leave the rest alone. I know the field
> name. Is there some reliable example code you know of that might performed
> this task?
> I have tried different examples I found online with no success. Any help
> will be appreciated.
> Thanks!
> Lorena