Add Content of an iText PDF File using java code
In many applications there is a need to generate pdf file dynamically. The iText library can be used to generate PDF documents from Java program. The iText is a open source library that provide facility to create pdf file from java application. iText is a freely available Java library from Lowagie.com, it supports the generation of HTML, RTF, and XML and PDFdocuments. You can use variety of fonts and colors in document. To use iText library you need to import package.....
In the example given below we will create a pdf file at the specified location. In this example we will first create Document object that has arguments page size, left right top and bottom margins. After that create object of PdfWriter class. Other writers are HtmlWriter, RtfWriter, XmlWriter etc.
Save this java code with .java , before run this code you need to add iText library so first download the .jar file of iText library and add to jdk library. If you are using any IDE, so you can directly add iText library to IDE. After that compile as a java code with javac command and run. This code will create a pdf file on specified location.