Document Page Count : Page Count « PDF RTF « Java






Document Page Count

Document Page Count
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class DocumentPageCountPDF {
  public static void main(String args[]) {
    try {
      Document doc = new Document(PageSize.A4, 50, 50, 100, 72);
      PdfWriter writer = PdfWriter.getInstance(doc,
          new FileOutputStream("DocumentPageCountPDF.pdf"));
      doc.open();

      Paragraph p = new Paragraph("text");

      doc.add(p);

      doc.close();
      System.out.println(writer.getPageNumber());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

}

           
       








itext.zip( 1,748 k)

Related examples in the same category