import java.io.FileInputStream; import java.io.FileOutputStream; import com.justformspdf.pdf.Form; import com.justformspdf.pdf.FormText; import com.justformspdf.pdf.PDF; import com.justformspdf.pdf.PDFReader; public class JustFormsPDFExample03MultilineText { public static void main(String[] args) { try { FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\JustFormsPDFMultiline02.pdf"); PDF pdf = new PDF(new PDFReader(fis)); Form form = pdf.getForm(); ((FormText) form.getElement("name")).setValue("John K. Baker"); ((FormText) form.getElement("phone")).setValue("1-888-732-2245"); //----------------------------------------------------- // Multiline with 'forced' line breaks (wrapping) // please note the line-break marker \\r //------------------------------------------------------ String address = "ABC Printing Inc.\\r" + "6224 Spring Valley Drive\\r" + "Thousand Oaks, CA"; ((FormText) form.getElement("address")).setValue(address); //----------------------------------------------------- // Multiline with auto-wrapping //------------------------------------------------------ String comments = "The JustFormsPDF library is a Java class library for " + "filling or editing interactive PDF forms on-the-fly. Empower " + "your applications with the industry standard PDF technology " + "using JustFormsPDF. "; ((FormText) form.getElement("comments")).setValue(comments); pdf.render(); pdf.writeTo(new FileOutputStream("C:\\JustFormsPDF\\examples\\JustFormsPDFMultiline02_out.pdf")); System.out.println("DONE "); } catch (Exception e) { e.printStackTrace(); } } }