How to Convert HTML to PDF in ASP.Net using C#. In this tutorial I am going to show how can easily generate a PDF document from HTML using the itext7 library.
Subscribe for more code samples and tutorials like this:
#htmltopdf
#CodeSample
In this tutorial I have used the following tools
1. Visual Studio 2017 Community Edition
3. JQuery CDN
4. HTML Minifier
5. itext7 HTML to pdf NuGet library
Download Source Code
…(read more)
Convert Word 2 PDF: Word to PDF Converter
Convert PowerPoint 2 PDF: PPT to PDF Converter
Convert Excel 2 PDF: Excel to PDF Converter
Convert an Image 2 PDF: Image to PDF Converter
Convert HTML 2 PDF: HTML to PDF Converter
More Tools: PDF Converter
public void CreatePDFFromDatabase(string url, string html, string destination)
{
ConverterProperties cp = new ConverterProperties();
cp.SetBaseUri(url);
HtmlConverter.ConvertToPdf(html, new FileStream(destination, FileMode.Create), cp);
} The problem is, that the text in Hebrew (including what comes from the DB) is not decoded into the PDF. How to decipher a language that is not English? (Hebrew for example)
Thank u very much for ur explanation.
How can store the PDF in custom URL ?
like currently it is saving in local server and i want to save in a specific folder of hosting site.
Can we do that?
Thanks in advance.
Not store image in folder
In base url
Can you possible getting image from url
Thank you very much for this nice video. I understood better the logic of itext 7.
I am sure itext7 is not free for commercial projects we have to take licensing. Please share your thoughts
What happen with the pdf report if the html template had more than one sheet? or if the table have a lot of items and needs more than one sheet?
Very useful video. Thanks alot. Sir, can you share code of this project. Thanks in advance.
Is it possible to generate from database
Very useful video
Can you show how to generate pdf from sql table. Thanks for this video