Cookies

This code demonstrates how to use IronPDF to authenticate a request using network credentials and apply cookies for rendering a webpage as a PDF.

  • ChromePdfRenderer: Used for rendering HTML content into PDF format.
  • RequestContexts.Global: Ensures that the PDF rendering maintains the same browsing context for lifetime of the process, enabling the use of cookies and authentication across requests.
  • ChromeHttpLoginCredentials: Provides network authentication when accessing web pages that require login credentials.
  • ApplyCookies: Applies the specified cookies and credentials to the HTTP request, vital for rendering secure pages.
  • uri: Represents the web address of a page that needs to be rendered into a PDF and typically requires user authentication. In this example, it points to a locally hosted webpage.

This setup is particularly advantageous when rendering PDFs from authenticated pages, such as invoices, reports, or dashboards that require user authentication.

Unlock the Full Potential of Cookies in PDF Rendering - Read Our How-To Guide Now!