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 Code https://github.com/iron-software/IronPdf.Examples/tree/main/examples/http-request-header Download ZIP Related Tutorial Related How-To Guide Class Documentation Get Language Packs Download IronPDF DLL Report an Issue on this page Ready to Get Started? Nuget Downloads 16,425,128 | Version: 2025.11 just released Free NuGet Download Total downloads: 16,425,128 View Licenses
All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)