Hi, Unfortunately PDF files aren't attached (probably due to a restriction on the mailing list). Could you open an issue on JIRA [1] and attach your PDF files and the Java Code you wrote in this email ?
Thank you in advance. BR, Eric [1] https://issues.apache.org/jira/browse/PDFBOX 2012/10/5 Eugene Chang <ech...@bonafide.com> > Hi,**** > > ** ** > > We have encounter a problem when using pdfbox.**** > > ** ** > > We have a pdf form with fields and font set to Courier (please see > attached pdf file PRP.pdf).**** > > ** ** > > After running the program below which tries to set the value of one of the > fields, font was being changed to Helvetica (please see attached pdf file > forms26916.pdf).**** > > ** ** > > Is there any way we can set the values and retain the original font?**** > > ** ** > > ** ** > > Regards,**** > > ** ** > > ** ** > > Eugene**** > > ** ** > > ** ** > > ** ** > > ** ** > > package lab;**** > > ** ** > > import java.io.File;**** > > ** ** > > import org.apache.pdfbox.pdmodel.PDDocument;**** > > import org.apache.pdfbox.pdmodel.PDDocumentCatalog;**** > > import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;**** > > ** ** > > public class TestBed1 {**** > > public static void main(String[] args) {**** > > try {**** > > PDDocument pdfDocument = > PDDocument.load("C:/Temp/pdf/PRP.pdf");**** > > PDDocumentCatalog docCatalog = > pdfDocument.getDocumentCatalog();**** > > PDAcroForm acroForm = docCatalog.getAcroForm();**** > > acroForm.getField("officeAfterHourAndTollFree").setValue(**** > > "Phone: (805) 777-7666 Fax: (805) 777-9876");**** > > File file = File.createTempFile("forms", ".pdf");**** > > pdfDocument.save(file.getCanonicalPath());**** > > pdfDocument.close();**** > > ** ** > > System.out.println(file.getCanonicalPath());**** > > } catch (Exception e) {**** > > e.printStackTrace();**** > > }**** > > }**** > > }**** > > ** ** >