This article demonstrates some simple ways of HTML to PDF conversion using C#.
Jan 27, 2020 PDF Online's free PDF-to-HTML tool extracts the images to a separate directory, writes the HTML, and keeps the hyperlinks that you already have in your PDF file. Links are the essential ingredient of the web, so the fact that this tool maintains them is critical to the functionality of the resulting web pages it creates. C# pdf reader free: Delete a page from a pdf control SDK system azure wpf html console SilentSpring-RachelCarson-19627-part31 c# pdf reader free: Delete page pdf file Library control class asp.net web page windows ajax StdsDiv-10-A1Signage8-10-20150-part328.
There are various scenarios when you need to perform HTML to PDF conversion. For example, you may want to convert a web page to PDF from within your application or you may need to generate PDF from the content of a WYSIWYG HTML editor. Another scenario could be converting the HTML page from a specific URL to PDF. In order to deal with such cases, you will learn how to perform HTML to PDF conversion. The HTML content could be a .html file or a web page from a URL.
HTML to PDF C# Converter API – Free Download
Aspose.PDF for .NET is a PDF manipulation API that lets you convert HTML documents to PDF seamlessly. You can either download API’s DLL or install its package from NuGet. Get your temporary license to use Aspose.PDF for .NET for free.
NuGet Package Manager
Package Manager Console
Steps to Convert HTML to PDF
- Download and install the Aspose.PDF for .NET
- Load the HTML content from file or URL
- Generate PDF from provided HTML content
Simple HTML to PDF C# Conversion
The following are the simple steps to convert an HTML file to PDF using Aspose.PDF for .NET.
- Create an instance of the HtmlLoadOptions class.
- Create an instance of Document class and initialize it with the HTML file’s path and HtmlLoadOptions object.
- Call Document.Save(String) method with the output PDF file’s name.
The following code sample shows how to convert HTML to PDF using C#.
Input HTML File
Converted PDF Document
Pdf To Html5 C# Download
HTML to PDF with Password-Protection
You can also convert HTML files to encrypted PDF documents using Aspose.PDF for .NET. The resultant PDF document can be protected with the user’s password, the owner’s password, access permissions, and cryptographic algorithm. You can encrypt the converted PDF using the Document.Encrypt() method. The following code sample shows how to convert an HTML file to an encrypted PDF.
Output
Pdf To Html5 C# Video
C# HTML to PDF Conversion using URL
Aspose.PDF for .NET also supports conversion from the live URLs. The following are the steps to convert a web page from a URL to PDF.
- Make a web request to the URL using WebRequest.
- Get the response of the web request into the Stream object.
- Create the Document object and initialize it with InputStream and HtmlLoadOptions objects.
- Save HTML stream as PDF using Document.Save() method.
The following code sample shows how to convert the web page to PDF.
Pdf To Html5 C# Tutorial
Conclusion
In this article, you have learned how to convert HTML content to PDF using programmatically using the .NET API. In addition to the simple conversion, this article also covered HTML to a password-protected PDF document and converting HTML from a web page to PDF. You can easily port the provided code snippets to perform this conversion in VB.NET.
You may learn more about Aspose.PDF for .NET using the documentation.
Related Article
Online Guide for Viewing, Annotating, Converting and Editing PDF Document in ASP.NET with C#.NET HTML5 PDF Viewer& Editor Library
A best HTML5 PDF viewer control for PDF Document reading on ASP.NET web based application using C#
A multiple functional HTML5 PDF document editor SDK for PDF document editing online in ASP.NET program
Free demo library and components for quick integration on various ASP.NET platforms
Support to view PDF document online in browser such as firefox, chrome, safari and so on
Support ASP.NET MVC, IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke) and SharePoint
A powerful PDF reader allows C# users to view PDF, annotate PDF file, create PDF from other file formats, convert PDF document in .NET framework class
An advanced PDF editor enable C# users to edit PDF text, image and pages in Visual Studio .NET project
Support to add password to PDF document and edit password on PDF file
Able to protect PDF document from editing, printing, copying and commenting by setting PDF file permissions
Help C# users to erase PDF text content, images and pages online in ASP.NET
RasterEdge C#.NET HTML5 PDF Viewer and HTML5 PDF Editor are professional online PDF manipulation tools, which are compatible with both 32-bit and 64-bit operating systems and .NET Framework 2.0 & above versions. It's easy to deploy RasterEdge C#.NET HTML5 PDF Viewer and Editor on various platforms such as Visual Studio .NET project and IIS ( Internet Information Services), ASP.NET MVC application, Azure Cloud Service ( Azure), SharePoint site, Dotnetnuke ( DNN) project.
This online HTML5 PDF document viewer library component offers reliable and excellent functionalities. C#.NET users and developers can view PDF online with convenient manipulation, add varieties of annotations to PDF freely online, create PDF document from multiple file formats or export PDF to Word, Tiff and image file formats. Please click to related guide below for more details.
With RasterEdge HTML5 PDF Editor for C#.NET, users can perform a lot of utility PDF editing functionalities in ASP.NET program. C# users are able to edit PDF text in ASP.NET, edit images on PDF document, edit PDF document page in ASPX webpage, set and edit PDF password, edit PDF file permissions and redact PDF text, image and page content to protect important information. Follow tables will guide you to related pages.
HTML5 PDF Viewer & Editor Deployment on Various Platforms
C#.NET: HTML5 PDF Viewer & Editor for Visual Studio .NETRasterEdge provide HTML5 PDF Viewer and Editor to help C# users to view, annotate, convert and edit PDF document on Visual Studio .NET application. Please click here for deployment guide. | C#.NET: HTML5 PDF Viewer & Editor for IIS (Internet Information Services)This page will tell C# users how to create RasterEdge HTML5 PDF Viewer and HTML5 PDF Editor on IIS. Please click for more details. |
C#.NET: HTML5 PDF Viewer & Editor for ASP.NET MVCRasterEdge HTML5 PDF Viewer & Editor for .NET are also professional toolkits, which able to be integrated in ASP.NET MVC project. Here you can know how to perform HTML5 PDF Viewer & Editor deployment on ASP.NET MVC. | C#.NET: HTML5 PDF Viewer & Editor for Azure (Azure Cloud Service)RasterEdge HTML5 Viewer & Editor provide C# users abilities of viewing and editing PDF document on Azure project. Please click for more details. |
C#.NET: HTML5 PDF Viewer & Editor for SharePointThis page will guide C# users how to deploy HTML5 PDF Viewer or Editor in SharePoint site with concrete procedures. Please click for more details. | C#.NET: HTML5 PDF Viewer & Editor for DNN (Dotnetnuke)This page give an tutorial on how to deploy RasterEdge HTML5 PDF Viewer or Editor on DNN site. Please refer to it for deployment on DNN. |
Use HTML5 PDF Viewer to View PDF Document in ASP.NET
This page shows some view functionalities of HTML5 PDF Viewer, as well as the usages of some tabs about view PDF document online. Please click for more details. | RasterEdge C#.NET HTML5 PDF Viewer allows users to add annotations to PDF online. Here explains some usages about HTML5 PDF Viewer annotation functionalities. |
RasterEdge C#.NET HTML5 PDF Viewer enable users to view create PDF from multiple file formats. Such as Word, Excel, PowerPoint, Tiff, images and other file formats. Please refer to more details here. | After viewed and edited PDF document in HTML5 PDF Viewer, PDF can be saved and exported to other specific file formats. Supported file informations are given on this page. |
Use HTML5 PDF Editor to Edit PDF Document in ASP.NET
Pdf To Html5 C# Free
With RasterEdge HTML5 PDF Editor for .NET, C# users are able to edit PDF text in ASP.NET project. Users can set PDF text font and size, bold and highlight text in easy ways. | With RasterEdge HTML5 PDF Editor for C#.NET, users can perform a lot of PDF image editing actions in ASP.NET project. Please Click for more details here. |
C#.NET: Edit PDF Page in ASP.NETRaterEdge HTML5 PDF Editor empower C#.NET users to edit PDF pages with multiple manipulation functionalities in ASP.NET application. More details are given on this page. | C#.NET: Edit PDF Password in ASP.NETRaterEdge HTML5 PDF Editor also provides C#.NET users secure solutions for PDF document protection. Users are able to set a password to PDF online directly in ASPX webpage. |
C#.NET: Edit PDF Permission in ASP.NETExcept password setting, RasterEdge HTML5 PDF Editor also enable C#.NET users to perform more actions to set PDF file permission. Please click for more details about PDF file permission setting on ASP.NET project. | C#.NET: Redact PDF Content in ASP.NETRaterEdge HTML5 PDF Editor for C#.NET allows users to protect important information through PDF redaction functionalities. C#.NET user can redact PDF text, PDF images and PDF page in ASP.NET program. |