Hi,

There is an example on how to change the default appearance in existing fields
https://stackoverflow.com/questions/47995062/pdfbox-api-how-to-change-font-to-handle-cyrillic-values-in-an-acroform-field

and see also the CreateSimpleFormWithEmbeddedFont.java example. Maybe this helps.

Tilman


Am 11.11.2019 um 18:12 schrieb Dan Forth:
  Thank you for the fast response.   We're currently typing out the defaults as 
in the code below:
  PDFont font = PDType1Font.HELVETICA; PDResources resources = new PDResources(); 
resources.put(COSName.getPDFName("Helv"), font); 
form.setDefaultResources(resources);

  PDTextField textSSN = new PDTextField(form); textSSN.setPartialName("SSN");  String 
defaultAppearance = "/Helv 12 Tf 0 0 9 rgb"; 
textSSN.setDefaultAppearance(defaultAppearance);

In some cases we need Helvetica in italics for select fields of text would like 
to be able to take the four lines and condense theminto a class and be able to 
change the Helvetica to Helvetica Italic  as a passed parameter.
And be able to do the same for display setting for selected fields:
  PDAppearanceCharacteristicsDictionary fieldAppearance = new 
PDAppearanceCharacteristicsDictionary(new       COSDictionary()); 
fieldAppearance.setBorderColour(new PDColor(new float[] {2,2,2}, 
PDDeviceRGB.INSTANCE)); fieldAppearance.setBackground(new PDColor(new float[] 
{1,1,2}, PDDeviceRGB.INSTANCE)); 
widget.setAppearanceCharacteristics(fieldAppearance);
We were hoping there was a shorter way than having to type all the lines for 
every text field we need to add.
Thank you again for any insight.    On Monday, November 11, 2019, 11:49:29 AM EST, 
Maruan Sahyoun <sahy...@fileaffairs.de> wrote:
Not sure I understand what you are trying to achieve.

AcroForm itself is not page oriented but the widgets i.e. the visual 
representation of the form fields are.

It's sufficient to add the default resources to the AcroForm itself and 
reference these in the form fields default appearance
string.

Maybe you could show some code of what you are currently doing and we can look 
at ways to improve that?

BR
Maruan

Is there a tutorial on how to create the default resources and default 
appearance settings in classes that can be applied when creating acro forms of 
multiple pages?  It would be useful to be able to create multiple default 
resource or appearance classes and apply them to the acro form fields as needed 
rather than type each one out in the long form
Thank you in advance for any suggestions you can offer this newb.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to