pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Overriding the font of a PDField
Date Thu, 28 Nov 2013 10:43:52 GMT
It's a String, so you can actually use
getDictionary().getString(COSName.DA) ... If you want to change the font
used you'll need to find the correct font name. The best way would be to
manually set a field to the properties you want to use, run the code and
then use that string to set the DA property in your app.

Keep in mind that this action will not embed the font in the file. So if
you're using non-standard fonts they will not be available for someone who
doesn't have them installed on their computer.


On Thu, Nov 28, 2013 at 11:39 AM, Akshay Rawat <projects@akshay.cc> wrote:

> Thanks for that.
>
>
> In PDFBox is see that
>
>       dap = textbox.getDictionary().getDictionaryObject(COSName.DA)
>
> gets the default appearance, which is a COSString. How do I use that to
> change the font for the particular field.
>
>
>
>
> On Nov 28, 2013, at 3:55 PM, Gilad Denneboom <gilad.denneboom@gmail.com>
> wrote:
>
> > The font used has nothing to do with the value of the field. This
> > information is encoded in the DA attribute of the field, which you can
> read
> > and write using via the field's COSDictionary object. AFAIK, there are no
> > direct getters or setters for this property.
> >
> >
> > On Thu, Nov 28, 2013 at 11:07 AM, Akshay Rawat <projects@akshay.cc>
> wrote:
> >
> >> I am working with an acroform which has fields. These fields specify
> their
> >> own fonts to use when a value is set (using `setValue`).
> >>
> >> Is there a way to override this font of the PDField, such that
> `setValue`
> >> text appears in a different font.
> >>
> >> I’ve asked this question here too.
> >>
> >>
> >> Thanks.
> >>
> >>
> >> Akshay Rawat
> >>
> >> Skype: akshayrawat
> >> Mobile: +91 9538780000
> >> http://www.akshay.cc
> >>
> >>
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message