pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evan Williams <evan.willi...@zapprx.com>
Subject A Dumb Acroform Question
Date Thu, 30 Mar 2017 13:54:13 GMT
I would like to change default font of every field in an existing PDF
form.This suggests to me that I should change the default appearance of the
acroform and, so be on the safe side (since I am not the author of these
forms), change the default appearance of each PDTextField (I don't care
about choice fields &c.)

All of the examples that I have been able to find of changing field
appearances are PDFBox 1.8 examples that  get the COS Dictionary, mess
around with it and reset the field dictionary AND THEN CREATE A NEW
INSTANCE OF THE FIELD (e.g. java - How to set the text of a PDTextbox to a
color? - Stack Overflow
<http://stackoverflow.com/questions/22073137/how-to-set-the-text-of-a-pdtextbox-to-a-color/22082301#22082301>),
which presents me with practical and aesthetic problems. The explanation
given for this is 'The field variable has to be renewed in between because
`PDVariableText` stores the default appearance in a hidden member during
initialization'. I would really like to avoid doing this if I don't have to.

I would think that, in 2.0, I could get away with something like:


*     field.setDefaultAppearance("/Helv 0 Tf 0 g");*

Can I get away with just that? Or do I need to create a new field instance?
-- 
*Evan Williams*
Sr. Software Engineer
evan.williams@zapprx.com

*www.ZappRx.com <http://www.zapprx.com/>*

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