Hi,

Recently, I need to convert my project PDF library from iText to PDFBox. I had 
trouble to adjust the text in the PDTextbox (the display font size is too big). 
By using iText library, I can just use "setField" to write the text without 
worry about the font size, etc... But with PDFBox library, "setValue" method 
won't adjust the font size automatically (base on the size of PDFBox.) Is there 
a way I can set the configuration before calling the setValue method to make 
all the text fit into PDTextbox automatically? Thank you very much for your 
help.


Best Regards,
Joe

Code Example:

        try {
                PDFTemplate = PDDocument.load("orderFormTemplate.pdf");
                PDDocumentCatalog docCatalog = PDFTemplate.getDocumentCatalog();
                PDAcroForm acroForm = docCatalog.getAcroForm();


            PDField pdField = acroForm.getField(field);
    if (pdField != null) {
pdField.setValue(value);//=== field is a multi-line PDTextbox
    }
:
:
PDFTemplate.save("newOrder.pdf");


        } catch (Exception e) {
    e.printStackTrace();
        } finally {
if (PDFTemplate != null)
  PDFTemplate.close();
    }

Reply via email to