R4R provide basic iText Tutorials concept with
iText Examples .
Through R4R you can develop iText programming concept. R4R provide
iText Interview Questions with answers.R4R provide iText Languages study materials in easy way.
iText APIs Tutorials
1.1 iText Basic Tutorials
iTEXT
iText is a
library of classes
which helps developers to improve the capabilities of their web server applications
java and other than java applications with dynamic PDF document generation .It was
written by Bruno Lowagie . iText API, can be used to simultaneously generate PDF, rich text, and
HTML documents. The portable document format (PDF) is the commonly used
document format now a days in the industry, due to its simplicity and portability. Mostly
all the application servers and other server give
direct support for generating HTML, and rich text documents, but no can
support the generation of PDF documents. iText is a Java based API
that fills this gap by providing a simple, easy-to-use PDF document generator.
iText has been ported to the .NET Framework under the name iTextSharp.
iTextSharp is written in C# and it has a separate code base, but it is synchronized to iText releases.
FEATURES OF iITEXT API
iText is the java based API that provide a simple ,easy to use
PDF document generator. iText has some features like:
1.It is easy to use java API
2.Generates multiple outputs like HTML, RTF, and PDF
simultaneously.
3.Security and Encryptions.
4.Writes to any Java output stream
5.Now it has been extended PDF
library, used for filling out forms, moving pages from one PDF to another, and
so on
INSTALLATION AND SETUP OF API
For iText API no installation is required. You have to download the
iText.jar file from the iText Web site and include it into the class
path. To use iText in an application server, place the iText.jar into a directory where
the application server can read it.
EXAMPLE
To generate a PDF, first you have create an instance of the Document
class and then create an instance of the PdfWriter
after that
passing the already created Document object and the output stream where the PDF document needs to be
pushed.
import java.io.FileOutputStream;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
public class iTextHelloWorld {
public static void main(String args[]) {
try {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("HelloWorld.pdf"));
document.open();
document.add(new Paragraph("Hello World !"));
document.close();
} catch (Exception e) {
System.out.println(e);
}
}
}