Our Dev/QA environments use self signed ssl certificates and we are trialing Abcpdf to convert html to pdf but the site where the html is rendered is run under a self signed SSL certificate.
Doc theDoc = new Doc();
theDoc.AddImageUrl("https://mysite/Test");
theDoc.Save(@"c:\tmp\htmlimport.pdf");
theDoc.Clear();
results in
WebSupergoo.ABCpdf9.Internal.PDFException : Unable to render HTML. Unable to access URL. COM error 800c0019. Security certificate required to access this resource is invalid.
The manual states for TimeStampServiceUrl :
ABCpdf uses System.Net.WebRequest to send the time-stamping request. You can use System.Net.ServicePointManager.ServerCertificateValidationCallback to customize trust relationship establishment when you connect to an SSL/TLS channel.
But nothing similar for AddImageUrl(), I have tried anyway and the callback is never hit:
public class PdfTester
{
public void Test()
{
ServicePointManager.ServerCertificateValidationCallback = ServerCertificateValidation;
Doc theDoc = new Doc();
theDoc.AddImageUrl("https://mysite/Test");
theDoc.Save(@"c:\tmp\htmlimport.pdf");
theDoc.Clear();
}
private static bool ServerCertificateValidation(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
Any ideas how to bypass this validation in this scenario?