ExceptionConverter:* java.io.IOException*: The document has no pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tramalingam
    New Member
    • Jul 2007
    • 3

    #1

    ExceptionConverter:* java.io.IOException*: The document has no pages

    Hello
    I am using iText framework.
    Getting the following error. The error is occurring when documet.close() is invoked.

    ExceptionConver ter:* java.io.IOExcep tion*: The document has no pages.
    at com.nri.xenos.r epor*t.text.pdf .PdfPages.*writ ePageTree(PdfPa g*es.java:107)
    at com.nri.xenos.r epor*t.text.pdf .PdfWriter*.clo se(PdfWriter.ja v*a:850)
    at com.nri.xenos.r epor*t.text.pdf .PdfDocume*nt.c lose(PdfDocumen t*.java:1043)
    at com.nri.xenos.r epor*t.text.Doc ument.clos*e(Do cument.java:497 )*

    What is the meaning of this?
    How shall I overcome it?
    please help me.

    Regards
    Thiru
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by tramalingam
    Hello
    I am using iText framework.
    Getting the following error. The error is occurring when documet.close() is invoked.

    ExceptionConver ter:* java.io.IOExcep tion*: The document has no pages.
    at com.nri.xenos.r epor*t.text.pdf .PdfPages.*writ ePageTree(PdfPa g*es.java:107)
    at com.nri.xenos.r epor*t.text.pdf .PdfWriter*.clo se(PdfWriter.ja v*a:850)
    at com.nri.xenos.r epor*t.text.pdf .PdfDocume*nt.c lose(PdfDocumen t*.java:1043)
    at com.nri.xenos.r epor*t.text.Doc ument.clos*e(Do cument.java:497 )*

    What is the meaning of this?
    How shall I overcome it?
    please help me.

    Regards
    Thiru
    Well, the error message says "the document has no pages" doesn't it?
    That is supposed to be a vital piece of information.

    Comment

    • tramalingam
      New Member
      • Jul 2007
      • 3

      #3
      Originally posted by r035198x
      Well, the error message says "the document has no pages" doesn't it?
      That is supposed to be a vital piece of information.
      There are pages in that particular document.Still i'm getting the error message.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by tramalingam
        There are pages in that particular document.Still i'm getting the error message.
        Your word against the computer's now.

        Care to post the code? And please make sure you use code tags for posting it.

        Comment

        • tramalingam
          New Member
          • Jul 2007
          • 3

          #5
          Originally posted by r035198x
          Your word against the computer's now.

          Care to post the code? And please make sure you use code tags for posting it.
          Thirs is what the code:

          import com.lowagie.tex t.pdf.PdfReader ;
          import com.lowagie.tex t.Document;
          import com.lowagie.tex t.pdf.PdfImport edPage;
          import com.lowagie.tex t.pdf.PdfCopy;
          import com.lowagie.tex t.pdf.PdfStampe r;
          import com.lowagie.tex t.pdf.AcroField s;
          import com.lowagie.tex t.DocumentExcep tion;
          import com.lowagie.tex t.pdf.PdfWriter ;
          import com.lowagie.tex t.Anchor;

          import java.io.FileOut putStream;
          import java.io.IOExcep tion;
          import java.io.*;
          import java.util.*;
          import java.util.regex .*;
          import java.rmi.Remote Exception;

          //extends Object;
          //implements DocListener;
          public class Document1{
          // creation of the document with a certain size and certain margins
          public static void main(String[] args) {
          Document document = new Document();

          try {
          // creation of the different writers
          PdfWriter pdf = PdfWriter.getIn stance(document ,
          new FileOutputStrea m("C:/Documents and Settings/TRamalingam/Desktop/HelloWorldPdf.p df"));
          // we add some meta information to the document
          document.addSub ject("This is the result of a Test.");

          // we open the document for writing
          document.open() ;
          Anchor pdfRef = new Anchor("see Hello World in PDF.");
          }
          catch(DocumentE xception de) {
          System.err.prin tln(de.getMessa ge());
          }catch (IOException ioe) {
          System.err.prin tln(ioe.getMess age());
          }
          document.close( );
          }
          }

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            So you've ignored my remark about having to use code tags?

            Here is the link to the itext tutorial.

            Comment

            Working...