pdf生成-如何让Abcpdf通过带有自签名证书的SSL呈现内容



我们的Dev/QA环境使用自签名ssl证书,我们正在尝试Abcpdf将html转换为pdf,但是呈现html的站点是在自签名ssl证书下运行的。

    Doc theDoc = new Doc();
    theDoc.AddImageUrl("https://mysite/Test");
    theDoc.Save(@"c:tmphtmlimport.pdf");
    theDoc.Clear();

搜索结果

WebSupergoo.ABCpdf9.Internal.PDFException : Unable to render HTML. Unable to access URL.
COM error 800c0019. Security certificate required to access this resource is invalid.

TimeStampServiceUrl的手册状态:

ABCpdf使用System.Net.WebRequest发送时间戳请求。你可以用System.Net.ServicePointManager.ServerCertificateValidationCallback来自定义信任关系的建立SSL/TLS通道。

但是对于addmageurl()没有类似的,我已经尝试过了,回调从未命中:

public class PdfTester
{
    public void Test()
    {
        ServicePointManager.ServerCertificateValidationCallback = ServerCertificateValidation;
        Doc theDoc = new Doc();
        theDoc.AddImageUrl("https://mysite/Test");
        theDoc.Save(@"c:tmphtmlimport.pdf");
        theDoc.Clear();
    }

    private static bool ServerCertificateValidation(
        object sender,
        X509Certificate certificate,
        X509Chain chain,
        SslPolicyErrors sslPolicyErrors)
    {
        return true;
    }
}

在这种情况下如何绕过此验证有什么想法吗?

尝试通过fiddler运行此程序,您可能会遇到由http://support.microsoft.com/kb/2677070

引起的此问题。

此问题的症状导致您将注意力集中在目标URL上,但可能存在对该KB文章中列出的windows更新URL的多个子请求以及对证书中的URL的请求。我们遇到了这个问题,fiddler能够在此过程中暴露502错误,从而导致800C0019错误。

我们通过将fiddler暴露的所有url添加到客户的异常列表来修复它,但是微软在这里修复了它。

当然这只是一种可能的解析度

最新更新