Shadrack created PDFBOX-3837:
--------------------------------

             Summary: PDFBox does not maintain the font appearence of a field 
if it appears severraly in a PDF Form
                 Key: PDFBOX-3837
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3837
             Project: PDFBox
          Issue Type: Bug
          Components: AcroForm
    Affects Versions: 2.0.5
         Environment: java web application running on ubutnu 14 and windows 10.

            Reporter: Shadrack
         Attachments: countycode.pdf

I have 5 fields with same name(lets say 'wcode') in different places on a one 
page pdf form. This fields have different fonts. Normally when you fill out one 
field manually the other fields automatically pick the sames value, the same 
this happens when I fill it using PDFbox except that PDFBox changes all my 5 
fields to have same font as the first field to appear in the pdf form.

Here is the code used to fill the field.

PDDocument _pdfDocument = PDDocument.load(new File(originalPdf))
PDAcroForm acroForm = _pdfDocument.getDocumentCatalog().getAcroForm();    
PDTextField myCodeField = (PDTextField) acroForm.getField("wcode");
       if (myCodeField != null) {
          myCodeField .setValue(my.getCode());
       }
//Refresh layout && Flatten the document                
       acroForm.refreshAppearances();
       acroForm.flatten();
 _pdfDocument.save(outputFile);


I added
    acroForm.refreshAppearances();
after some research but that did not change anything.

So if the first 'wcode' field to appear on the pdf form is 6pt all the other 
'wcode' fields in the rest the pdf will be 6pt even if I had set them in 
appearance properties to 12pt.

On the attached pdf the affected field is called CountyCode



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to