How to format text in pdf template with iText -
i have created pdf template 'open office writer' , filled fields itext. in pseudo code this:
pdfreader reader = new pdfreader("c:/temp/template.pdf"); fileoutputstream fileoutputstream = new fileoutputstream("c:/temp/templatetest.pdf"); pdfstamper stamper = new pdfstamper(reader, fileoutputstream); stamper.setformflattening(true); stamper.getacrofields().setfield("description", "this important description."); stamper.close();
now want word 'important' in 'description' text bold. how can handle this? possible change given format in pdf template itext , substrings well?
you've defined text field in pdf along font should used text field, e.g. helvetica. in case, can use font. can't introduce font, such helvetica-bold.
what you're looking not text field, rich text field. in case, set rich text value. rich text value looks html, it's different. can consult iso-32000-1 find out what's different it.
you can fill out rich text field itext, but... if don't flatten form. because if want itext render special-flavored html, need code parse html. actually: that's in xfa worker, doesn't because don't have xfa form, have acroform.
long story short: read chapter 8 of book, , you'll find example fill out fields using columntext
, field positions. if don't have book, take @ movieads example.
Comments
Post a Comment