How to Convert HTML to PDF in .NET with HiQPdf v10.17.0
How to Convert HTML to PDF in .NET with HiQPdf v10.17.0
If you are looking for a reliable and easy-to-use HTML to PDF converter for .NET, you should check out HiQPdf v10.17.0. This is a powerful library that allows you to convert any HTML document or web page to PDF in minutes, with high quality and accuracy.
HiQPdf HTML to PDF Converter for .NET v10.17.0
In this article, we will show you how to use HiQPdf v10.17.0 to convert HTML to PDF in .NET, and what features and benefits it offers.
What is HiQPdf v10.17.0?
HiQPdf v10.17.0 is the latest version of the HiQPdf HTML to PDF Converter for .NET, a library that can convert any HTML document or web page to PDF, with support for CSS3, SVG, web fonts, JavaScript, page breaks, headers and footers, encryption, digital signatures, and more.
HiQPdf v10.17.0 works with any .NET framework from 2.0 to 4.8, and supports both 32-bit and 64-bit platforms. It can be used in ASP.NET, Windows Forms, WPF, Azure, or any other .NET application.
HiQPdf v10.17.0 is fast, lightweight, and easy to integrate into your .NET project. You can use it with C#, VB.NET, or any other .NET language.
How to use HiQPdf v10.17.0 to convert HTML to PDF in .NET?
To use HiQPdf v10.17.0 to convert HTML to PDF in .NET, you need to follow these simple steps:
Add a reference to the HiQPdf.dll assembly in your .NET project.
Create an instance of the HtmlToPdf class.
Set the properties of the HtmlToPdf object according to your preferences and requirements.
Call the ConvertUrl or ConvertHtml method of the HtmlToPdf object, passing the URL or the HTML string of the document or web page you want to convert.
Save the resulting PDF document to a file or a stream, or send it to the browser.
Here is an example of C# code that converts a web page to PDF using HiQPdf v10.17.0:
```csharp
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
// set the license key
htmlToPdfConverter.LicenseKey = "your license key here";
// set the PDF page size and orientation
htmlToPdfConverter.Document.PageSize = PdfPageSize.A4;
htmlToPdfConverter.Document.PageOrientation = PdfPageOrientation.Portrait;
// set the margins
htmlToPdfConverter.Document.Margins = new PdfMargins(20);
// set the header and footer
htmlToPdfConverter.Document.Header = new PdfHeader(50);
htmlToPdfConverter.Document.Footer = new PdfFooter(50);
// add some text and a logo image to the header
htmlToPdfConverter.Document.Header.Add(new PdfText(5, 5,
"This is a header text", new System.Drawing.Font("Arial", 10)));
htmlToPdfConverter.Document.Header.Add(new PdfImage(5,
htmlToPdfConverter.Document.Header.Height - 40,
100, System.Drawing.Image.FromFile("logo.png")));
// add some text and a page number to the footer
htmlToPdfConverter.Document.Footer.Add(new PdfText(5,
htmlToPdfConverter.Document.Footer.Height - 15,
"This is a footer text", new System.Drawing.Font("Arial", 10)));
htmlToPdfConverter.Document.Footer.Add(new PdfText(
htmlToPdfConverter.Document.Footer.Width - 15,
htmlToPdfConverter.Document.Footer.Height - 15,
"Page CrtPage of PageCount", new System.Drawing.Font("Arial", 10)));
// convert the URL to PDF
string url = "https://www.hiqpdf.com/demo/ConvertHtmlToPdf.aspx";
PdfDocument pdfDocument = htmlToPdfConverter.ConvertUrl(url);
// save the PDF document to a file
string pdfFile = @"C:\Temp\HiQPdf.pdf";
pdfDocument.WriteToFile(pdfFile);
// open the PDF document in the default PDF viewer
System.Diagnostics.Process.Start(pdfFile);
```
What features and benefits does HiQPdf v10.17.0 offer?
HiQPdf v10.17.0 offers many features and benefits that make it a great choice for HTML to PDF conversion in .NET. Here are some of them:
It supports HTML5, CSS3, SVG, web fonts, JavaScript, and other modern web standards.
It can render complex HTML layouts, including tables, columns, floats, flexbox, grid, and more.
It can handle dynamic and interactive web pages, including AJAX requests, animations, forms, and events.
It can convert multiple HTML documents or web pages to a single PDF document or to separate PDF files.
It can convert HTML documents or web pages from local files, URLs, streams, or strings.
It can add bookmarks, outlines, links, and metadata to the PDF document.
It can encrypt and digitally sign the PDF document.
It can customize the PDF page size, orientation, margins, header, footer, and more.
It can control the PDF compression level and quality.
It can optimize the PDF document for fast web view.
It can merge, split, insert, delete, rotate, crop, resize, watermark, stamp, and secure PDF documents.
It can extract text and images from PDF documents.
It can create PDF forms and fill them with data.
It can create PDF reports from data sources.
It can create PDF charts from data.
How to get HiQPdf v10.17.0?
If you want to get HiQPdf v10.17.0 and start converting HTML to PDF in .NET with ease and efficiency, you can download it from the official website: https://www.hiqpdf.com/
You can also get a free trial version that works for 60 days with no limitations. You just need to request a trial license key from the website.
If you decide to buy HiQPdf v10.17.0, you can choose from three licensing options: Developer License ($395), Team License ($995), or Enterprise License ($1995). All licenses include free updates and support for one year.
How to use HiQPdf v10.17.0 in ASP.NET?
If you want to use HiQPdf v10.17.0 in ASP.NET, you can easily convert HTML to PDF in your web pages or web services. You can also use the HiQPdf HTML to PDF Converter for .NET Web API that allows you to convert HTML to PDF from any platform or language that can make HTTP requests.
Here is an example of ASP.NET code that converts a web page to PDF and sends it to the browser:
```csharp
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
// set the license key
htmlToPdfConverter.LicenseKey = "your license key here";
// set the PDF page size and orientation
htmlToPdfConverter.Document.PageSize = PdfPageSize.A4;
htmlToPdfConverter.Document.PageOrientation = PdfPageOrientation.Portrait;
// set the margins
htmlToPdfConverter.Document.Margins = new PdfMargins(20);
// convert the URL to PDF
string url = "https://www.hiqpdf.com/demo/ConvertHtmlToPdf.aspx";
PdfDocument pdfDocument = htmlToPdfConverter.ConvertUrl(url);
// send the PDF document to the browser
byte[] pdfBuffer = pdfDocument.WriteToMemory();
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Length", pdfBuffer.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=HiQPdf.pdf");
Response.BinaryWrite(pdfBuffer);
Response.End();
```
How to use HiQPdf v10.17.0 in Azure?
If you want to use HiQPdf v10.17.0 in Azure, you can easily deploy your .NET application that uses the library to the cloud. You just need to make sure that you have the proper license key and that you copy the HiQPdf.dll assembly and the dependencies (wkhtmltopdf.exe and libeay32.dll) to your Azure project.
You can also use the HiQPdf HTML to PDF Converter for .NET Web API that allows you to convert HTML to PDF from any platform or language that can make HTTP requests.
Here is an example of how to use the Web API in Azure:
```csharp
// create a WebClient object
WebClient webClient = new WebClient();
// set the license key
webClient.Headers.Add("HiQPdfLicenseKey", "your license key here");
// set the URL of the HTML document or web page to convert
string urlToConvert = "https://www.hiqpdf.com/demo/ConvertHtmlToPdf.aspx";
// call the Web API method that converts HTML to PDF
byte[] pdfBuffer = webClient.DownloadData(
"https://api.hiqpdf.com/v1/HtmlToPdf?uri=" + HttpUtility.UrlEncode(urlToConvert));
// send the PDF document to the browser
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Length", pdfBuffer.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=HiQPdf.pdf");
Response.BinaryWrite(pdfBuffer);
Response.End();
```
How to use HiQPdf v10.17.0 in Windows Forms?
If you want to use HiQPdf v10.17.0 in Windows Forms, you can easily convert HTML to PDF in your desktop applications. You can also use the HiQPdf HTML to PDF Converter for .NET WinForms Viewer that allows you to preview and print the PDF document in a Windows Forms control.
Here is an example of Windows Forms code that converts a web page to PDF and shows it in a WinForms Viewer:
```csharp
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
// set the license key
htmlToPdfConverter.LicenseKey = "your license key here";
// set the PDF page size and orientation
htmlToPdfConverter.Document.PageSize = PdfPageSize.A4;
htmlToPdfConverter.Document.PageOrientation = PdfPageOrientation.Portrait;
// set the margins
htmlToPdfConverter.Document.Margins = new PdfMargins(20);
// convert the URL to PDF
string url = "https://www.hiqpdf.com/demo/ConvertHtmlToPdf.aspx";
PdfDocument pdfDocument = htmlToPdfConverter.ConvertUrl(url);
// create a WinForms Viewer control
HiQPdf.PdfViewer.PdfViewerControl pdfViewerControl = new HiQPdf.PdfViewer.PdfViewerControl();
// set the PDF document to display
pdfViewerControl.Document = pdfDocument;
// add the WinForms Viewer control to the form
this.Controls.Add(pdfViewerControl);
// resize the WinForms Viewer control to fill the form
pdfViewerControl.Dock = DockStyle.Fill;
```
How to use HiQPdf v10.17.0 in WPF?
If you want to use HiQPdf v10.17.0 in WPF, you can easily convert HTML to PDF in your WPF applications. You can also use the HiQPdf HTML to PDF Converter for .NET WPF Viewer that allows you to preview and print the PDF document in a WPF control.
Here is an example of WPF code that converts a web page to PDF and shows it in a WPF Viewer:
```csharp
// create the HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
// set the license key
htmlToPdfConverter.LicenseKey = "your license key here";
// set the PDF page size and orientation
htmlToPdfConverter.Document.PageSize = PdfPageSize.A4;
htmlToPdfConverter.Document.PageOrientation = PdfPageOrientation.Portrait;
// set the margins
htmlToPdfConverter.Document.Margins = new PdfMargins(20);
// convert the URL to PDF
string url = "https://www.hiqpdf.com/demo/ConvertHtmlToPdf.aspx";
PdfDocument pdfDocument = htmlToPdfConverter.ConvertUrl(url);
// create a WPF Viewer control
HiQPdf.PdfViewer.Wpf.PdfViewerControl pdfViewerControl = new HiQPdf.PdfViewer.Wpf.PdfViewerControl();
// set the PDF document to display
pdfViewerControl.Document = pdfDocument;
// add the WPF Viewer control to the window
this.Content = pdfViewerControl;
// resize the WPF Viewer control to fill the window
pdfViewerControl.HorizontalAlignment = HorizontalAlignment.Stretch;
pdfViewerControl.VerticalAlignment = VerticalAlignment.Stretch;
```
Conclusion
HiQPdf v10.17.0 is a powerful and easy-to-use HTML to PDF converter for .NET that can handle any HTML document or web page with high quality and accuracy. It supports HTML5, CSS3, SVG, web fonts, JavaScript, and other modern web standards. It can customize the PDF document with page size, orientation, margins, header, footer, bookmarks, outlines, links, metadata, encryption, digital signatures, and more. It can also merge, split, insert, delete, rotate, crop, resize, watermark, stamp, secure, extract text and images, create forms and reports, and create charts from PDF documents. It can be used in ASP.NET, Windows Forms, WPF, Azure, or any other .NET application. It can also be used with the HiQPdf HTML to PDF Converter for .NET Web API that allows you to convert HTML to PDF from any platform or language that can make HTTP requests.
If you want to try HiQPdf v10.17.0 for yourself, you can download it from the official website: https://www.hiqpdf.com/ You can also get a free trial version that works for 60 days with no limitations. You just need to request a trial license key from the website.
If you want to buy HiQPdf v10.17.0, you can choose from three licensing options: Developer License ($395), Team License ($995), or Enterprise License ($1995). All licenses include free updates and support for one year.
HiQPdf v10.17.0 is the ultimate HTML to PDF converter for .NET that you need for your projects. Don't miss this opportunity and get it today! b99f773239
- +