Java Programing laungage

iText Projects

iText Project 1

Set the page size of PDF file
Previous Home Next

The iText library is very useful tool by help of this jar file we can set the page size of PDF file. If it is exist then PDF file automatically set the size of page otherwise PDF file  will be created. for making the program for set the size of page firstly import the iText jar file, in which two interface is too important that support to the creation of PDF file and manipulation it.

These interfaces are:

  • com.lowagie.text.pdf.*; and
  • com.lowagie.text.*;


package r4r;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

public class pagesize 
public static void main(String[] args)throws Exception
Document doc=new Document(PageSize.A4,40,40,40,40);
PdfWriter.getInstance(doc,new FileOutputStream("pagesize.pdf"));;
doc.add(new Paragraph("hello bhai"));
Previous Home Next