I am using org.apache.pdfbox to read pdf and outfill some fields.
Now I have to problem that the font size is much too big.
I thought it would be easy to set font size to 12 . But it is very complicated .
Actually it is awful. Does anyone know how to do it ? This is my code without styling.
final PDDocument document = PDDocument.load(template);
PDPage page = new PDPage(PDRectangle.A4);
document.addPage(page);
final PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
final Iterator<PDField> it = acroForm.getFieldIterator();
for (PDField f : acroForm.getFields()) {
System.out.println(f.toString());
if (f instanceof PDTextField) {
f.set
f.setValue("Some value");
}
};
As discussed in the comments, the result of
is
which means Helvetica, size 0 (= variable size), and color black (grey colorspace, 0 is black, 1 is white).
Thus to set a specific size, call