C# NReco.PdfGenerator错误:AuthenticationRequiredError

C# NReco.PdfGenerator错误:AuthenticationRequiredError,c#,nreco,C#,Nreco,我在我的web项目(Visual studio 2012,c#)中使用了“NReco.PdfGenerator.dll”, 并且可以成功地从internet url(如)导出 但当我将url更改为内部url(公司内部系统外) 我收到了这个错误信息: “由于网络错误,无法生成代码为1的PDF:Exit:AuthenticationRequiredError(退出代码:1)” 这是我的密码: 新建NReco.PdfGenerator.HtmlToPdfConverter().GeneratePDDF

我在我的web项目(Visual studio 2012,c#)中使用了“NReco.PdfGenerator.dll”, 并且可以成功地从internet url(如)导出 但当我将url更改为内部url(公司内部系统外) 我收到了这个错误信息:

“由于网络错误,无法生成代码为1的PDF:Exit:AuthenticationRequiredError(退出代码:1)”

这是我的密码:

新建NReco.PdfGenerator.HtmlToPdfConverter().GeneratePDDFFromFile(“”,null,AppDomain.CurrentDomain.BaseDirectory+“test.pdf”)

谁能帮我解决这个问题???
非常感谢

当指定的URL返回HTTP代码401(未经授权)时,wkhtmltopdf(内部PdfGenerator在单独的过程中执行)将返回AuthenticationRequiredError

在大多数情况下,这意味着该网页只能由经过身份验证的用户访问;在大多数web应用程序中,身份验证令牌通过cookie或HTTP头传递

您可以传递带有特殊wkhtmltopdf选项的任一cookie,例如:

var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.CustomWkHtmlArgs = " --cookie <name> <value>";
var htmlToPdf=new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.CustomWkHtmlArgs=“--cookie”;
额外HTTP头的选项:

htmlToPdf.CustomWkHtmlArgs = " --custom-header <name> <value> ";
htmlToPdf.CustomWkHtmlArgs=“--custom header”;

请注意,不可能呈现需要windows身份验证的URL;在这种情况下,wkhmtltopdf应使用其他身份验证机制访问这些页面。

非常感谢