Office software is closely linked to the PDF,the PDF is also must have to control!      Set home Page  Add to Favorites  
You are here:Home > PDF info > PDF-related reference
PDF-related reference
From Java applications dynamically generate PDF documents
Finishing by: Date:2009-4-14 20:18:43 Popularity: Tags:
If an application need to dynamically generate PDF documents, you need to iText library. IText open source library to enable the creation of PDF documents can be completed in an instant. This paper introduces the use of iText and provide it from Java? Technology applications to generate PDF files of the easy-to-digest guide. We have created a sample application to better understand iText.

Many applications require dynamically generated PDF documents. Such applications include e-mail delivery for the bank to generate customer statements, to the readers to buy a specific book chapters and in PDF format to receive these documents. Listed examples of this are many. In this article, will use the iText Java library to generate PDF documents, and guide you through an example application to enable you to better understand and use the iText.

Familiar with iText

iText is site (see reference) of the Java library provided free of charge. iText library function is very powerful to support HTML, RTF and XML document generation, in addition to be able to generate PDF documents. Can choose from a variety of fonts used in the document fonts. At the same time, iText allows the use of the same structure of the code generation more than any type of document.

iText class library for a variety of fonts to generate PDF text, in PDF documents generated in the form, add watermark and so on for pages. iText also provides many of the features. In an article is impossible to demonstrate. This article will introduce to generate PDF documents basic needs.

We will use Eclipse for application development example. As an open source IDE, can be obtained free of charge Eclipse, and its very powerful. Now you can download Eclipse.

IText API: a closer look

com.lowagie.text.Document generated PDF is the main class. It is the need to use the first category. Once the creation of documents, would require a writer to write the contents of the document. com.lowagie.text.pdf.PdfWriter is a PDF writer. Here is a list of classes usually need to use:

com.lowagie.text.Paragraph - This category indicates a paragraph indent.

com.lowagie.text.Chapter - this type of PDF document that chapter. Paragraph use as a subject and use int as chapter number to create it.

com.lowagie.text.Font - This category includes all of the font specification, such as font, size, style and colors. A variety of fonts in this category are stated as a static constant.

com.lowagie.text.List - a list of the type that, according to the order of many ListItems.

com.lowagie.text.Table - this type of cell that contains the table, in an orderly manner with the cell in the matrix.

Download iText carried out in the Eclipse configuration

As a pure Java library, iText is a JAR file of the form (see references). Once you have downloaded the library (in the path C: \ temp under), will perform the following steps to configure Eclipse environment iText library:

In Eclipse create a new Java project named iText.

In the Package Explorer view, right-click iText project, and then select Properties.

Click Java Build Path. In the Libraries tab, click Add External JARs.

Browse to C: \ temp directory, select the directory itext-1.3.jar.

Click OK.

Has now been configured iText, Eclipse are ready to create Java applications to generate dynamic PDF documents.
there isArticle InformationsComment Information
Category column

Site Help | Site Map | Feedback |
OAPDF.COM Copyright 2009 V1.1