Website & System Logins

IronPDF for Python can render web pages that sit behind HTTP Basic Authentication by supplying login credentials directly to the renderer.

Getting Started

Create a ChromePdfRenderer and assign a ChromeHttpLoginCredentials object to its LoginCredentials property before calling RenderUrlAsPdf. IronPDF will include the credentials in the HTTP request used to fetch the page.

Understanding the Code

  • ChromeHttpLoginCredentials: Holds the username and password used for HTTP Basic Authentication.
  • LoginCredentials.NetworkUsername: The username to authenticate with the server.
  • LoginCredentials.NetworkPassword: The corresponding password.
  • RenderUrlAsPdf(url): Fetches the URL with the supplied credentials and renders the resulting page as a PDF.

Additional Rendering Options in This Example

The example also configures several RenderingOptions properties before rendering:

  • MarginTop / MarginBottom: Sets page margins in millimeters.
  • TextHeader / TextFooter: Adds text-based headers and footers with dynamic fields such as {pdf-title}, {date}, {time}, {page}, and {total-pages}.
  • CssMediaType: Set to Print so print-specific CSS rules are applied.

Use Cases

Supplying login credentials is useful when rendering internal dashboards, intranet pages, staging environments, or any URL protected by HTTP Basic Auth that your application needs to export as a PDF.

Learn to convert HTML to PDF with IronPDF for Python!

Ready to Get Started?
Version: 2026.6 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast?
run a sample watch your HTML become a PDF.