pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eli colner <ecol...@yahoo.com>
Subject Re: Changing font of PDTextbox
Date Thu, 06 Mar 2014 19:08:38 GMT
OK, so it appears that creating a new field instance solved this.

I used this thread as a reference for anybody facing similar challenge:
http://stackoverflow.com/questions/22073137/how-to-set-the-text-of-a-pdtextbox-to-a-color




________________________________
 From: eli colner <ecolner@yahoo.com>
To: "users@pdfbox.apache.org" <users@pdfbox.apache.org> 
Sent: Wednesday, March 5, 2014 2:08 PM
Subject: Changing font of PDTextbox
 

How is it possible to change the font of a textbox?

I tried 

PDDocument pdf = PDDocument.load(originalPdf);
PDDocumentCatalog docCatalog = pdf.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
PDField field = acroForm.getField( "topmostSubform[0].Page1[0].Entity[0].p1-t4[0]" );
field.getDictionary().setString(COSName.DA, PDType1Font.COURIER.getBaseFont());
field.setValue("Testing font change");

I also searched for the answer to this and couldn't figure it out.
https://www.google.com/search?as_q=textbox+font&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fmail-archives.apache.org%2Fmod_mbox%2Fpdfbox-users%2F&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=


Any help would be much appreciated.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message