Java Programing laungage

iText Projects

iText Project 1

adplus-dvertising
Introduction to Chunk in iText
Previous Home Next

By the help of this program I am trying to show you how we are using the chunk in PDF file. The Chunk is a small significant part of the text which is used to add the document for performing this task firstly we are import to the iText.jar file and some packages like com.lowagie.text.pdf.*, com.lowagie.text.*.

After import of the package we are going to insert to the image into the PDF file. Then apply to wrap on that image.

Example:

package r4r;
import java.awt.Color;
import java.io.FileOutputStream;
import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.Chunk;
import com.lowagie.text.pdf.PdfWriter;

public class chunktests 
	{
public static void main(String arg[])throws Exception
	{
Document doc=new Document();
PdfWriter.getInstance(doc,new FileOutputStream(
"chunktests.pdf"));
doc.open();
Chunk ch=new Chunk("Welecome To Java World.");
ch.setUnderline(+1f,-2f);
Chunk ch1=new Chunk("My eclips framework");
ch1.setUnderline(+4f,-2f);
ch1.setBackground(Color.red);
doc.add(ch);
doc.add(ch1);
doc.close();
}
}
Previous Home Next