How to make PDF of a page running behind windows authentication?

291 Views Asked by At

I'm trying to make PDF's of some webpages on the same site but since the website is behind Windows Authentication it failes. I can load the page markup using a HttpRequest and WindowsIdentity.Impersonate() but when the PDF plugin tries to create the PDF this is, naturally, without any stylesheets.

I'm using TuesPechkin and wkhtmltopdf to generate the PDF's. This is a ASP.NET webforms solution. Any suggestions?

1

There are 1 best solutions below

0
On

I think the LoadSettings class is where you want to look. If the Username and Password properties don't propagate through to the external resources (CSS, images, etc.) you can try setting up a basic Authentication header yourself in the CustomHeaders dictionary and setting the RepeatCustomHeaders property to true.