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.

In SelectPdf’s .NET HtmlToPdf converter, a page header appears only after you set converter.Options.DisplayHeader = true. Then set the header height, add header content, convert the HTML, and save and close the returned PdfDocument. For the REST API, use show_header=true with header_height and either header_html or header_url.

Convert HTML and add a header in .NET

The key is to configure the header before calling the conversion method. The following example follows SelectPdf’s documented HtmlToPdf conversion and document-save lifecycle. The header-element constructor shown is an illustrative pattern; confirm the overload against the SelectPdf package version used by your project and the examples in the official headers and footers guide.

using SelectPdf;

string html = "<html><body><h1>Quarterly report</h1><p>Report content goes here.</p></body></html>";

var converter = new HtmlToPdf();
converter.Options.DisplayHeader = true;
converter.Header.Height = 50;
converter.Header.Add(new HtmlToPdfElement("<div>Quarterly report</div>", ""));

PdfDocument document = converter.ConvertHtmlString(html);
document.Save("output.pdf");
document.Close();

The sample uses a string as its input. SelectPdf’s getting-started guide documents the HtmlToPdf converter, ConvertHtmlString, and the save-and-close flow; consult it for the lifecycle and your installed package’s API details: Getting Started with Html to Pdf Converter for .NET.

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

What each header setting does

  • Options.DisplayHeader is the on/off switch. SelectPdf documents that when it is false, the header is not displayed and its other header settings have no effect.
  • Header.Height reserves vertical space for the header. Choose enough room for its content so it does not crowd the page body.
  • Header.Add(...) adds an element to the header area. Keep the header markup focused on the content that should recur as a page header, such as a short report name or branding.
  • ConvertHtmlString converts the supplied HTML string into a PdfDocument. Save the document to a file, then close it when finished.

These are separate PDF page-header controls, not the same thing as a table’s column-heading row. A repeating HTML table header is a distinct conversion feature in SelectPdf’s documentation.

Plan the header layout and page visibility

A header occupies a defined region of each PDF page. The height must suit the actual header content; if it is too small, the header may not fit cleanly, while reserving more room than needed takes space away from the page body. Inspect the resulting PDF with representative content rather than assuming that a setting which works for one page layout will suit all of them.

Choose which pages show it

SelectPdf’s .NET header options include visibility controls for the first page and for odd and even pages. Decide these deliberately when a document has a cover page, or when alternating pages need a different treatment. For example, a cover might omit the recurring page header while subsequent pages include it. Check the header guide for the property names and usage for the SelectPdf version you have installed.

Keep header content appropriate to a page region

Use concise markup and check the rendered output at the page size and with the source content your application will actually convert. A long title, large image, or unexpected wrapping can need more reserved height. If you are using the REST API with raw header HTML, provide a base URL when the markup relies on relative assets; see the API parameters reference below.

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

Configure a header through the REST API

SelectPdf’s v2 REST parameter reference documents header controls for API callers. Enable the header with show_header=true, set header_height, and supply the header using either header_html or header_url. These are alternative ways to provide the header content; use the one that fits your integration.

Parameter Use
show_header Enable or disable display of the header.
header_height Reserve space for the header.
header_html Provide header markup directly.
header_url Provide a URL for the header content.
header_base_url Give relative assets in raw header HTML a base URL for resolution.

The API reference also documents controls for whether the header appears on the first page and on odd or even pages. Consult SelectPdf HTML to PDF API Parameters — v2 REST Reference for the precise parameter names and current request requirements. The reference is the appropriate place to check the complete API request shape; the controls above describe the header-specific part.

Rank #2
The SQL Programming Language: .
  • Used Book in Good Condition

Choose the .NET library or REST API

SelectPdf presents a .NET converter and an online API as distinct integration options. Pick based on where the conversion belongs in your application rather than assuming they have identical deployment or licensing requirements.

Consideration .NET library REST API
Integration shape Use the HtmlToPdf converter from a .NET application. Send a request to the online API using its documented parameters.
Where conversion is invoked Within an application that can use the SelectPdf .NET library. Across an API integration, subject to the provider’s current API terms and requirements.
Header configuration Options.DisplayHeader and the Header object. show_header, header_height, and header content parameters.
Commercial details Check SelectPdf’s current product and license information. Check the current API product terms separately; do not assume the library license describes API usage.

SelectPdf describes its .NET library as a per-developer licensed product and distinguishes it from the Community Edition and online API. Product versions, licensing, and pricing can change, so review the vendor’s current HTML to PDF Converter for .NET page before choosing an edition.

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

Check Community Edition limits before using it

SelectPdf’s Community Edition page says that it supports custom HTML headers and footers, and that generated PDFs are limited to five pages. That makes the edition relevant for short documents and evaluation, but the page limit matters if a conversion can produce a longer report. Check the current SelectPdf Community Edition terms and feature list before relying on it for a production workload.

Do not treat the five-page limit as a general property of every SelectPdf edition. The vendor distinguishes the free Community Edition from commercial software; confirm the conditions for the specific product and version you plan to use.

Troubleshoot headers that are missing or misplaced

  • No header appears: First check the visibility switch: converter.Options.DisplayHeader in .NET or show_header=true in REST. SelectPdf explicitly documents that other header options have no effect when display is disabled.
  • Header markup is configured but has no content: Verify that you added an element to the .NET Header, or supplied header_html or header_url for REST. A height setting reserves space; it does not itself provide content.
  • Header content is clipped or crowded: Increase the reserved header height to suit the rendered content, then inspect the output again. The appropriate value depends on the markup and its layout.
  • Relative images or styles in REST header HTML do not resolve: Supply an appropriate header_base_url when using raw HTML with relative resources. An absolute resource URL is another way to avoid relying on relative-path resolution.
  • The header appears on an unwanted page: Review the first-page and odd/even-page visibility settings. A cover page and alternating-page layout may need different visibility choices.
  • The wrong kind of heading repeats: A PDF page header and an HTML table’s repeating heading row are different features. Configure the page header for page-level content; use the table-header conversion behavior when the need is repeated column headings.
  • The output exceeds the free edition’s allowance: If you are using Community Edition, compare the document length with its stated five-page maximum and check the current edition terms before troubleshooting the conversion as a rendering failure.

Or skip the browser setup

If your real need is a clean capture of a web page rather than a SelectPdf-generated PDF with a configured document header, ScreenshotNeo is a separate website screenshot API. It can return PNG, JPEG, WebP, or PDF, but the request below is the documented screenshot example and saves a WebP image; it does not configure a SelectPdf-style page header.

Quick Recap

Bestseller No. 1
Bestseller No. 2
The SQL Programming Language: .
The SQL Programming Language: .
Used Book in Good Condition
$4.23
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for its API details. ScreenshotNeo accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with the response identifying the page verdict and billing status in headers. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Learn more at ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

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.