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 toPrintso 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.






