Java Programing laungage

iText Projects

iText Project 1

adplus-dvertising
Wrap Image into PDF file
Previous Home Next

By the help of this program I am trying to show you how we can wrap an image in PDF file after insertion. 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.io.FileOutputStream;

/import javax.swing.text.Document;

import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.Image;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class wrapimagetest 
	{
public static void main(String[] arg)throws Exception
	{
Document doc=new Document();
PdfWriter.getInstance(doc,new FileOutputStream(
"wrapimagetest.pdf"));
doc.open();
Image img = Image.getInstance ("d:/r4r/wrapimage/images/bag.jpg");
Paragraph par=new Paragraph(
"R4R is a free tutorials site for the java and .net technology ");
doc.add(par); 
doc.add(img); 
doc.close();
}
}
Previous Home Next