Hello programmers!

I recieved the following assignment to do in C#.net:

It is a class that:
* Accepts an HTML report string
* Converts the HTML string into a PDF file using PDF Creator (free open source library)

What are some utilities that I will need to use?
I so far programmed only console applications, and I only included the system library.
Is the PDF Creator already in Visual Studio, or do I need to download it. I tried to find out throught its website, but it did not show this.

Recommended Answers

All 7 Replies

This shouldn t be too hard to do. Altough I m not sure what do you have to do in the end. Do you have to have the html in your PDF with the tags included or is it just the output of your html that you have to have in your PDF?.
Have a look at this link to get you started
Click Here
and type itextsharp into youtube to see how it works in action.

I will most likely find out next sunday.

Thanks for directing me to itextsharp. I am looking at it now.

You should have a look at this too:
nreco.pdfgenerator official site
nreco nugget
Here's the basic example, after adding the library to your project:

var htmlContent = String.Format("<body>Hello world: {0}</body>", 
        DateTime.Now);
var pdfBytes = (new NReco.PdfGenerator.HtmlToPdfConverter()).GeneratePdf(htmlContent);

hi,

It is very difficult to convert HTML to PDF without any 3rd party tools. I would recommend you to try C# PDF component. It allows to convert html string/file/url to PDF including styles, you can try this feature with the free trial version.And this programming guide gives a sample of how to convert HTML string to PDF in C#. Good luck.

regards.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.