This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This technical tip shows how to Java Developers can add text in an existing PDF file using Aspose.Pdf for Java. To add text to an existing PDF file Open the input PDF using the Document object and get the particular page to which you want to add the text. After that create a TextFragment object with the input text along with other text properties. The TextBuilder object created from that particular page – to which you want to add the text – allow you to add the TextFragment object to the page using the AppendText method. Now just call the Document object's Save method and save the output PDF file.
The following code snippet shows you how to add text in an existing PDF file.
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("input.pdf");
com.aspose.pdf.TextBuilder textBuilder = new com.aspose.pdf.TextBuilder(pdfPage);
// append the text fragment to the PDF page
<bt>// save updated PDF file
Overview: Aspose.Pdf for Java