Java iText apis

iText Projects

iText Project 1

iText In Java

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.

iText APIs Tutorials and Interview Question
Features of iText APIs

iText is the java based API that provide a simple ,easy to use PDF document generator. iText has some features like

  • It is easy to use java API.
  • Generates multiple outputs like HTML, RTF, and PDF simultaneously.
  • Security and Encryptions.
  • Writes to any Java output stream.
  • 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

Examples

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);
       }
   }
}

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: