Jump to content

iText

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 77.56.125.101 (talk) at 15:34, 29 June 2013 (Updated version.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

iText®
Developer(s)1T3XT BVBA
Stable release
5.4.2 / May 31, 2013; 11 years ago (2013-05-31)
Repository
Written inJava, C#
Operating systemCross-platform
TypeLibrary
LicenseAGPLv3[1]
Proprietary
Websitehttp://itextpdf.com/

iText is a free and open source library for creating and manipulating PDF files in Java. It was written by Bruno Lowagie, Paulo Soares, and others. As of version 5.0.0 (released Dec 7, 2009) it is distributed under the Affero General Public License version 3. Previous versions of iText (Java up to 2.1.7 and C# up to 4.1.6) were distributed under the Mozilla Public License or the LGPL. iText is also available through a proprietary license, distributed by iText Software Corp. iText® is a registered trademark by 1T3XT BVBA.

iText has been ported to the .NET Framework under the name iTextSharp. iTextSharp is written in C# and it has a separate codebase, but it is synchronized to iText releases.[2]

Features

Developers will use iText to:

  • Serve PDF to a browser
  • Generate dynamic documents from XML file or databases
  • Use PDF's many interactive features
  • Add bookmarks, page numbers, watermarks, barcodes, etc.
  • Split, concatenate and manipulate PDF pages
  • Automate filling out PDF forms
  • Add digital signatures to a PDF file

Typically, iText is used in projects that have one of the following requirements:

  • The content isn't available in advance: it's calculated based on user input or real-time database information.
  • The PDF files can't be produced manually due to the massive volume of content: a large number of pages or documents.
  • Documents need to be created in unattended mode, in a batch process.
  • The content needs to be customized or personalized; for instance, the name of the end user has to be printed on a number of pages.

Often you'll encounter these requirements in web applications, where content needs to be served dynamically to a browser. Normally you'd serve this information in the form of HTML, but for some documents, PDF is preferred over HTML for better printing quality, for identical representation on a variety of platforms, for security reasons, or to reduce the file size.

iText provides support for most advanced PDF features such as PKI-based signatures, 40-bit and 128-bit encryption, color correction, PDF/X, color management via ICC profiles and barcodes.

History

The library was developed by Bruno Lowagie in the winter of 1998 as in-house project at Ghent University to create a PDF documents application for the student administration. The library (formerly known as rugPdf) was a very small and complex library with minimum functionality, such as simply reading and writing PDF files. The developer had to be knowledgeable of PDF syntax, objects, operators and operands to work with the library.

In 1999, Lowagie threw away the rugPdf code and wrote a new library, iText, from scratch. Lowagie created iText as a library that Java developers can use to create PDF documents without knowing PDF syntax, and released it as a Free and Open Source Software (FOSS) product on February 14, 2000. In the summer of 2000, Paulo Soares joined the project and is now one of the main developers of new iText features.

In 2006, a first book was published "iText in Action, Creating and Manipulating PDF", of which more than 11,000 copies were sold.[3]

iText is embedded in many products and services, including Eclipse BIRT, Jasper Reports, Red Hat JBoss Seam, Windward Reports, pdftk, and others.[4]

In late 2008, iText became available for proprietary license; and in early 2009 iText Software Corp. was formed to be the worldwide licensor of iText products.

In 2010, the second edition of the book "iText in Action" was released. It was a complete rewrite with new examples.

Licensing and fork

Versions of iText through 4.1.6/4.2.0 were released under the MPL and LGPL licenses, which allowed them to be used in closed-source software projects. At the end of 2009, with the release of iText 5, the license was switched to the Affero General Public License v3. Projects that do not want to provide their source code may either purchase a commercial license to iText 5 for an undisclosed price or continue using previous versions of iText under the more liberal license without any changes.[5] However, developer Bruno Lowagie has warned that versions prior to 5 may have included code that was not legally licensed under the LGPL, so that closed-source users of previous versions may be liable for copyright infringement.[6] The AGPL license is not compatible with the GPL license, although an AGPL library can be linked to a GPL program.

Example

The following source code generates a PDF file as a Hello World example.

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

Further reading

  • Lowagie, Bruno (Summer 2010). iText in Action (2nd ed.). Manning Publications. p. 600. ISBN 978-1-935182-61-0.
  • Lowagie, Bruno (8 December 2006). iText in Action (1st ed.). Manning Publications. p. 656. ISBN 1-932394-79-6.
  • PDF Generation Made Easy by Benoy Jose
  • Generate PDF files from Java applications dynamically by Amit Tuli, Staff Software Engineer, IBM
  • Creating PDFs on Android — an evaluation by Stefan Fenz
  • Create PDF With iText Java Tutorial
  • Itext Add / Insert Image Into PDF

See also

References