Pdf generation by iTextSharp library

Discussion in 'Software' started by Viswagreypad, Oct 11, 2007.

  1. Viswagreypad

    Viswagreypad

    Joined:
    Oct 11, 2007
    Messages:
    1
    Hi,
    I am new to this forum and as well as new to use iTextPdf library for pdf genearation.
    My domain is .Net.

    Here is my problem.
    I had followed an example which was give by iTextSharp tutorial.
    The example is in Java and I converted it to .Net(C#).

    Here is my code.
    -----------------------------

    // step 1: creation of a document-object
    Document document = new Document(iTextSharp.text.PageSize.A4);

    // step 2:
    // we create a writer that listens to the document
    // and directs a PDF-stream to a file
    PdfWriter.GetInstance(document, new FileStream("Chap0101.pdf", FileMode.Create));

    // step 3: we open the document
    document.Open();
    //document.NewPage();

    //Font font = iTextSharp.text.FontFactory.GetFont("Calibri", 20);
    // step 4: we add a paragraph to the document
    document.Add(new Paragraph("Hello World"));

    // step 5: we close the document
    document.Close();




    I am geetting the following error :

    "The document has no pages." in PdfPages.cs


    Kindly help me on this.....


    With Regards,
    Viswa.
    Viswagreypad, Oct 11, 2007
    #1
    1. Advertising

  2. Viswagreypad

    putty511

    Joined:
    Oct 22, 2007
    Messages:
    1
    I too got the same message, please help me /let me know if you get the answer. I could temporarily resolve this error by deleting the created pdf file after every executon, but i know that would not solve the problem,

    Also, i need to convert immages in html to pdf, ccould you help me with this also?

    My email is putty511@gmail.com
    putty511, Oct 23, 2007
    #2
    1. Advertising

  3. Viswagreypad

    unholy

    Joined:
    Jun 21, 2005
    Messages:
    3,899
    Location:
    Australia
    Noted that u commented out the "//document.NewPage();" line? does that work or not?

    If not maybe theres some sort of property u need to set for a new page?
    unholy, Oct 24, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Silverstrand

    Ultra Products 2nd Generation 500W X-Finity PSU

    Silverstrand, Oct 11, 2005, in forum: Front Page News
    Replies:
    0
    Views:
    682
    Silverstrand
    Oct 11, 2005
  2. Silverstrand
    Replies:
    0
    Views:
    650
    Silverstrand
    Jan 10, 2006
  3. =?Utf-8?B?Q2hyaXM=?=

    New Generation of Microsoft Certifications vs MCSD

    =?Utf-8?B?Q2hyaXM=?=, Oct 27, 2005, in forum: Microsoft Certification
    Replies:
    3
    Views:
    635
    Ole Kristian BangÄs
    Nov 1, 2005
  4. Juergen Kluth
    Replies:
    1
    Views:
    1,192
    Charlie Russel - MVP
    Feb 5, 2009
  5. BVermani

    iTextSharp - Need help for headers

    BVermani, Sep 29, 2009, in forum: General Computer Support
    Replies:
    0
    Views:
    6,219
    BVermani
    Sep 29, 2009
Loading...

Share This Page