IRONSOFTWAREHOME
HTTP Request Header
using IronPdf;
using System.Collections.Generic;

var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HttpRequestHeaders = new Dictionary<string, string>
{
    { "Authorization", "Bearer test-token-123" }
};

// Render PDF from authenticated page
var pdf = renderer.RenderUrlAsPdf("https://httpbin.org/bearer");
pdf.SaveAs("output.pdf");
Imports IronPdf
Imports System.Collections.Generic

Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.HttpRequestHeaders = New Dictionary(Of String, String) From {
    {"Authorization", "Bearer test-token-123"}
}

' Render PDF from authenticated page
Dim pdf = renderer.RenderUrlAsPdf("https://httpbin.org/bearer")
pdf.SaveAs("output.pdf")
NuGet Download
PM > Install-Package IronPdf
HTTP Request Header

HTTP Request Header

This code demonstrates how to use HTTP request headers in IronPDF to render a PDF from an authenticated webpage. It begins by creating an instance of ChromePdfRenderer, which is responsible for converting web pages or HTML into PDFs. Next, it sets up HTTP request headers by assigning a dictionary to the HttpRequestHeaders property within RenderingOptions. In this case, an Authorization header is added with a Bearer token (test-token-123), which is commonly used for authentication in APIs.

Once the headers are set, the RenderUrlAsPdf method is used to fetch and convert the webpage at https://httpbin.org/bearer into a PDF. This particular URL is a test API that requires Bearer authentication, making it a useful way to verify that the header is being correctly sent. Finally, the resulting PDF file is saved as "output.pdf" in the current directory. This approach is beneficial for generating PDFs from authenticated web pages, such as protected reports, dashboards, or API-generated content.

Learn to Set HTTP Headers for PDF Rendering with IronPDF
View on GitHub

Ready to Get Started?

Nuget Downloads 21,105,021Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999