1 Replies - 7936 Views - Last Post: 10 March 2009 - 09:36 AM Rate Topic: -----

#1 yx89   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-March 09

How to convert html to pdf using C# tried to do but got error

Post icon  Posted 10 March 2009 - 08:17 AM

Hi all,

How to convert html to pdf?

I am using Itextsharp.dll as my library, cause i found 2 other library but are under License so i cant use it

i tried to follow the ExpertPDF method of geting the property but i just cant not get it to work
		private PdfDocument GetPDFConverter()
		{
			int pageWidth = 0;
			int pageHeight = 0;

			PdfDocument pdfConverter = new PdfDocument(pageWidth, pageHeight);  //<--(The type 'iTextSharp.text.pdf.PdfDocument' has no constructors defined)

			pdfConverter.GetRight = false; <--error also
		 

			return pdfConverter;
		}



How can i do it?
As i not sure how to read the data from the library


Thank You

Mod Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: How to convert html to pdf using C# tried to do but got error

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6258
  • View blog
  • Posts: 24,026
  • Joined: 23-August 08

Re: How to convert html to pdf using C# tried to do but got error

Posted 10 March 2009 - 09:36 AM

//The PDF doc to create
PdfDocument doc = new Document(PageSize.LETTER);

// The underlying file stream
FileStream fs = File.Create(pathToFileToCreate, 1024, FileOptions.None);

// The writer
PdfWriter writer = PdfWriter.GetInstance(doc, fs);

doc.Open();



There is a tutorial here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1