Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Pdf generation by iTextSharp library

Reply
Thread Tools

Pdf generation by iTextSharp library

 
 
Viswagreypad Viswagreypad is offline
Junior Member
Join Date: Oct 2007
Posts: 1
 
      10-11-2007
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.
 
Reply With Quote
 
 
 
 
putty511 putty511 is offline
Junior Member
Join Date: Oct 2007
Posts: 2
 
      10-23-2007
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
 
Reply With Quote
 
 
 
 
unholy unholy is offline
Senior Member
Join Date: Jun 2005
Location: Australia
Posts: 3,928
 
      10-24-2007
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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
itextsharp pdf generation, insert image header. guoqi zheng ASP .Net 4 10-13-2011 05:47 PM
Using itextsharp to generate pdf from asp.net =?Utf-8?B?U2Vhbg==?= ASP .Net 5 07-16-2008 01:03 PM
Problem sending PDF as stream using iTextSharp antonyliu2002@yahoo.com ASP .Net 5 07-11-2007 08:12 PM
Creating PDF in ASP.NET - iTextSharp Neven Klofutar ASP .Net 1 05-10-2007 09:42 PM
Using iTextSharp for PDF Creation... Nique ASP .Net 0 08-17-2004 10:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57