Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use SelectPdf’s HtmlToPdf class: call ConvertUrl for a web address or ConvertHtmlString for markup, save the returned PdfDocument, and close it. For HTML that uses relative images or stylesheets, pass a base URL so SelectPdf can resolve those assets.

Choose the SelectPdf package before writing code

SelectPdf is distributed through NuGet. The current installation guidance lists Select.HtmlToPdf.NetCore for modern .NET (including .NET 5 through .NET 10 and supported .NET Core/.NET Standard targets) and Select.HtmlToPdf for legacy .NET Framework 2.0–4.5. The vendor’s .NET Core guidance is Windows-specific; it does not run on Linux or macOS. Confirm the package version and operating-system support for your deployment before committing to an architecture.

  1. In Visual Studio, open Tools → NuGet Package Manager → Manage NuGet Packages for Solution, or run dotnet add package Select.HtmlToPdf.NetCore for a modern .NET project.
  2. Install one main SelectPdf package only. If you choose the Blink or Chromium engine, add the matching companion package documented for that version. WebKit is the default bundled option.
  3. Build and run on the same Windows target class used in production. A conversion that works on a developer workstation does not prove that fonts, permissions, native dependencies, or engine binaries are available on the server.

Convert a URL to PDF

ConvertUrl is the shortest path when the source is already published at an HTTP or HTTPS address.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
using SelectPdf;

var converter = new HtmlToPdf();
var document = converter.ConvertUrl("https://www.example.com");
document.Save("output.pdf");
document.Close();

Save can write to a file, stream, memory buffer, or HTTP response. Always close the returned PdfDocument after saving; the API reference says closing releases the system resources used during conversion.

#1 Best Overall
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
  • Convert your PDF files into Word, Excel & Co. the easy way
  • Convert scanned documents thanks to our new 2022 OCR technology
  • Adjustable conversion settings
  • No subscription! Lifetime license!
  • Compatible with Windows 11, 10, 8.1, 7 - Internet connection required

Returning the PDF from ASP.NET Core

using Microsoft.AspNetCore.Mvc;
using SelectPdf;

[ApiController]
[Route("pdf")]
public class PdfController : ControllerBase
{
    [HttpGet("from-url")]
    public IActionResult FromUrl([FromQuery] string url)
    {
        if (!Uri.TryCreate(url, UriKind.Absolute, out var parsed) ||
            (parsed.Scheme != Uri.UriSchemeHttp && parsed.Scheme != Uri.UriSchemeHttps))
            return BadRequest("url must be an absolute HTTP or HTTPS URL");

        var converter = new HtmlToPdf();
        var document = converter.ConvertUrl(parsed.ToString());
        using var stream = new MemoryStream();
        document.Save(stream);
        document.Close();
        return File(stream.ToArray(), "application/pdf", "page.pdf");
    }
}

Validate and restrict destinations in a real service. Accepting arbitrary URLs can turn a PDF endpoint into a server-side request forgery risk. Consider an allowlist, outbound network policy, authentication requirements, and request-size and time limits.

Convert an HTML string

Use ConvertHtmlString when your application generates markup itself, such as an invoice or report.

using SelectPdf;

string html = "<html><body><h1>Invoice 1007</h1><p>Amount: $42.00</p></body></html>";

var converter = new HtmlToPdf();
var document = converter.ConvertHtmlString(html);
document.Save("invoice.pdf");
document.Close();

Resolve relative CSS and images with a base URL

Markup such as <img src="images/logo.png"> or <link href="css/site.css"> has no location when supplied as a plain string. Pass a base URL as the second argument:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
using SelectPdf;

string html = @"
<html>
  <head>
    <link rel='stylesheet' href='css/report.css'>
  </head>
  <body>
    <img src='images/logo.png' alt='Company logo'>
    <h1>Monthly report</h1>
  </body>
</html>";

var converter = new HtmlToPdf();
var document = converter.ConvertHtmlString(html, "https://www.example.com/reports/");
document.Save("report.pdf");
document.Close();

The base URL is used to resolve relative references; it is not a replacement for making those resources reachable. Protect private assets with appropriate authentication or embed them as data where suitable.

Rank #2
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
  • Convert over 50 document file formats.
  • Preview your files from Doxillion before converting them.
  • Use batch conversion to convert thousands of files at once.
  • Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
  • Burn your converted or original files directly to disc.

Pick the rendering engine for your page

SelectPdf documents WebKit, WebKit Restricted, Blink, and Chromium engines. These are vendor descriptions rather than independent benchmark results.

Engine Documented fit Deployment note
WebKit Default option; suitable for ES5 JavaScript and classic CSS. Bundled default; verify behavior with your pages.
WebKit Restricted WebKit variant documented by SelectPdf. Check the vendor’s restrictions and version guidance.
Blink Modern HTML/CSS and ES6 JavaScript on supported modern targets. Install the matching Blink companion package when required.
Chromium Modern HTML/CSS and JavaScript. Distributed through a separate Chromium.Windows NuGet companion package.

Engine and package compatibility is version-sensitive. Check the official engine and installation documentation for your target framework and host, then render representative pages in the intended environment. Inspect pagination, fonts, images, and JavaScript-driven sections rather than assuming browser-perfect output.

URLs, strings, and dynamic pages: practical decisions

Use ConvertUrl when

  • The page is publicly reachable or your converter can authenticate to it.
  • Stylesheets, images, and scripts should resolve exactly as they do from the published page.
  • You want SelectPdf to load the document as a browser-like navigation.

Use ConvertHtmlString when

  • The server owns the markup and you want to avoid publishing an intermediate URL.
  • You need to inject per-request data into a template.
  • You can provide a stable base URL or absolute asset URLs.

For either path, make sure the conversion process can reach every required resource. Relative paths, blocked outbound traffic, login redirects, client-side rendering, and missing fonts are common causes of apparently “empty” PDFs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Page limits, licensing, and trial differences

SelectPdf’s Community Edition page describes a free product for personal and commercial use, with no watermark and a limit of five pages per generated PDF. That edition is distinct from the commercial library’s trial, which the vendor describes as exposing full features while watermarking every page. The commercial library removes those limits under its license. Confirm the current page limit and licensing terms on the vendor’s pages before shipping or purchasing.

Rank #3
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.

The self-hosted library is also distinct from SelectPdf’s hosted REST API. Decide whether your requirements favor a library running in your Windows application or an online service, and review current terms directly with SelectPdf.

Reliability and production checklist

  • Dispose deterministically: save first, then call Close(), including in error-handling paths.
  • Use unique output names: avoid concurrent requests overwriting the same file.
  • Control concurrency: conversion is resource-intensive; queue jobs or cap parallel work according to observed memory and CPU usage.
  • Set operational timeouts: protect the web request from pages that never finish loading, while allowing enough time for legitimate assets.
  • Test deployment parity: verify native engine files, fonts, write permissions, and outbound access on the production Windows host.
  • Review sensitive data: PDFs may contain personal or financial information; secure temporary files and response headers.
  • Check every output: examine page breaks, clipped content, missing glyphs, image resolution, links, and script-generated sections.

Troubleshooting common failures

“The type or namespace name SelectPdf could not be found”

The project does not reference the package, or the package targets a framework your project cannot use. Install the package matching your target framework, restore NuGet packages, and rebuild.

The application runs locally but fails on the server

Verify that the server is Windows when using the documented .NET Core package, that the correct engine companion package is deployed, and that the process can read engine files and write its output. Compare the runtime and package versions between environments.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Images or CSS are missing from HTML strings

Relative paths need a base URL in ConvertHtmlString(html, baseUrl). Alternatively use absolute URLs or embed resources. Confirm that the conversion host can reach the asset URLs without an interactive login.

Rank #4
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
  • Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
  • Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
  • Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
  • Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
  • Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.

JavaScript content is absent

The selected engine may not support the page’s JavaScript level, or the page may require asynchronous data after the initial load. Try the documented Blink or Chromium option where your target supports it, and simplify or server-render critical content. Validate the result in the deployment environment.

Only part of the document is produced

Check the Community Edition’s five-page limit and licensing mode first. If the limit is not involved, inspect CSS page-break rules, oversized elements, failed resources, and conversion timeouts.

Fonts or symbols are wrong

Install the required fonts on the conversion host or use a font available there. Missing fonts can change line wrapping and pagination even when the HTML appears correct in a developer browser.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your requirement is a clean capture of a live page rather than a SelectPdf-generated document, ScreenshotNeo provides a website screenshot API and MCP server. A single request can return PNG, JPEG, WebP, or PDF. Its cleanup step accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. AI agents can use its MCP tools take_screenshot, get_page_info, and capture_pdf.

See the ScreenshotNeo documentation for all options. The basic cURL call is:

Best Value
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
  • ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
  • MAXIMUM FUNCIONALITY – create interactive forms, compare PDFs, bates numbering, find and replace text or colors, convert documents, OCR engine, comment, highlight, fill out and print forms, document protection and others
  • EASY TO INSTALL AND USE – well-structured user-interface, in-program instructions, free tech support whenever you need it
  • GREAT VALUE FOR MONEY - why spend a fortune if you can have maximum functionality at a reasonable price - this also fits the requirements of companies very well
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

There is a free allowance of 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo to try it.

Equivalent calls in Python and Node.js

These examples call ScreenshotNeo’s endpoint directly when an image or PDF capture is more appropriate than running a local HTML renderer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

Frequently Asked Questions

Does SelectPdf work on Linux or macOS?

The current vendor guidance for the modern .NET Core package is Windows-specific and says it does not run on Linux or macOS. Verify support for the exact package and version you plan to deploy.

What is the difference between ConvertUrl and ConvertHtmlString?

ConvertUrl loads a page from an HTTP or HTTPS address. ConvertHtmlString renders markup held by your application; pass a base URL when that markup contains relative assets.

Why must I close PdfDocument?

SelectPdf’s API reference requires closing the document after saving to release conversion resources.

The Bottom Line

Install the package that matches your .NET framework and Windows deployment, use ConvertUrl for pages and ConvertHtmlString plus a base URL for generated markup, save the PdfDocument, and close it every time. Validate engine behavior, licensing limits, and output fidelity on the host that will run in production.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
Convert your PDF files into Word, Excel & Co. the easy way; Convert scanned documents thanks to our new 2022 OCR technology
$29.99
Bestseller No. 2
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Convert over 50 document file formats.; Preview your files from Doxillion before converting them.
Bestseller No. 3
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
Bestseller No. 4
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.; Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
$99.99
Bestseller No. 5
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
$29.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.