GdPicture.NET is a Nutrient product. Learn more

HTML-to-PDF SDK for .NET: Convert web content to PDF

Transform HTML files, webpages, and email documents into PDF with full rendering of images, CSS, forms, hyperlinks, and JavaScript. Convert from strings, files, or URLs, with complete control over page size and formatting.


HTML viewing and conversion toolkit

View HTML content, convert to PDF, and capture HTML streams with full support for CSS, JavaScript, images, SVG, hyperlinks, and forms. Instance pooling enables faster batch processing.

HTML viewing and conversion toolkit
HTML viewing

Display HTML pages in WinForms and WPF viewers with complete rendering of modern web content.

PDF conversion

Convert HTML to PDF and capture HTML streams in DocuVieware for seamless web-to-document workflows.

Performance optimization

Manage a pool of browser instances for faster processing while maintaining full CSS, JavaScript, and form support.

Settings

Page width

Set the output page width in points. Default: 1920.

Page height

Set the output page height in points. Default: 1080.

Page margins

Specify the left/right/top/bottom page margin in points of the resulting document when converting from the source HTML file.

CSS page size

Honor CSS-defined page sizes and adjust paper dimensions to fit content.

Browser path

Specify a custom browser path for HTML rendering.

Browser pool size

HTML-to-PDF use cases

Practical ways to use HTML support in your applications.

Webpage capture

Convert websites, blog articles, and online documentation to PDF for offline access, archiving, or editing in a viewer.

HTML viewing

Display and interact with HTML content directly inside your application’s viewer.

PDF integration

Insert HTML content into existing PDFs, convert standalone pages, or index HTML for search and retrieval.


Browser requirements

GdPicture.NET uses Chrome or Edge rendering engines for accurate HTML display. If either browser is already installed, no additional setup is needed.

If neither is installed:


  1. Download Google Chrome Portable and place it in the installation folder.
  2. Set the path to chrome.exe using the SetWebBrowserPath() method.
HTML browser requirements

Demo

HTML-to-PDF viewer in action

Enter a URL to see how DocuVieware renders HTML content directly in the browser.

Loading HTML viewer...

GET STARTED

How to use

Download and install the GdPicture.NET package to access compiled demo applications and multi-language sample projects with full source code.

Explore demo apps
Find compiled demo applications in
\Samples\Bin\.
Explore multi-language source code
Find C# and VB.NET demo apps and source code in \Samples\WinForm\.
Visit reference guide
Explore other code snippets within the online reference guide.

Example of usage

The example creates a PDF document from an HTML file.

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.html", GdPicture14.DocumentFormat.DocumentFormatHTML);
// Save the output in a new PDF document.
gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");

Trusted by 3,000+ customers and Fortune 500 companies

15Y+
More than 15 years of experience developing our SDK
10K+
Trusted by more than 10,000 developers


Frequently asked questions

What functionalities does the GdPicture.NET HTML-to-PDF SDK offer?

The SDK provides comprehensive features, including:

  • HTML viewing — Render HTML files, webpages, and email documents within applications.
  • Conversion to PDF — Transform HTML content into PDF documents, preserving layouts and styles.
  • Support for web technologies — Accurately process and render images, CSS, JavaScript, forms, and hyperlinks within HTML content.
  • Flexible input sources — Convert HTML from strings, files, or URLs, offering versatility in handling various HTML content sources.
  • Customization options — Control page size, margins, and formatting to tailor the output PDF to specific requirements.

These features enable the integration of dynamic HTML content into PDF workflows, enhancing document management and presentation.

Is a specific browser required for HTML rendering in the SDK?

Yes. The SDK utilizes Chrome’s rendering engine to ensure high-fidelity HTML processing. If Chrome or Edge is installed on the machine, the SDK will automatically utilize it. If not, developers can:

  • Install Google Chrome Portable — Place it in the application’s installation directory.
  • Specify the browser path — Use the SetWebBrowserPath() method to define the path to the Chrome executable.

This setup ensures consistent and accurate rendering of HTML content.

Can the SDK handle dynamic web content, including JavaScript execution?

Absolutely. The GdPicture.NET HTML-to-PDF SDK fully supports the execution of JavaScript, enabling accurate rendering of dynamic and interactive web content within the converted PDF. This ensures elements such as client-side scripts and dynamic data are faithfully reproduced in the output document.

What customization options are available during the HTML-to-PDF conversion process?

The SDK offers extensive customization capabilities, enabling developers to:

  • Set page dimensions — Define custom page widths and heights to match specific layout requirements.
  • Adjust margins — Specify top, bottom, left, and right margins to control content positioning.
  • Emulate media types — Choose between screen or print media types to influence CSS application and rendering styles.
  • Control pagination — Opt to fit content into a single page, or distribute it across multiple pages as needed.

These options provide flexibility to tailor the PDF output to diverse application needs.

Is the GdPicture.NET HTML-to-PDF SDK suitable for high-performance applications?

Yes. The SDK is designed with performance in mind. It supports the management of a pool of browser instances, which can be configured to optimize processing speed and resource utilization. This feature is particularly beneficial for applications requiring the conversion of multiple HTML documents concurrently, ensuring efficient and rapid processing.

Is GdPicture’s HTML-to-PDF engine the same one used in Nutrient’s web and mobile SDKs?

Yes. GdPicture.NET belongs to the Nutrient product family, and the HTML rendering and conversion technology is consistent across Nutrient’s desktop, web, and mobile SDKs, delivering reliable web-to-PDF transformation across platforms.

60-day free trial

Try GdPicture.NET now!