PDF conversion suddenly fails if reading stylesheet from SSL

我怕爱的太早我们不能终老 提交于 2019-12-08 00:44:33

问题


I've been using EvoPdf version 3.5 without problem for long but all of a sudden it can’t read a stylesheet from SSL.

string html = "<link href=\"https://www.domain.com/styles.css\" rel=\"stylesheet\" type=\"text/css\" />Test";
PdfConverter pdfConverter = new PdfConverter();
byte[] bytes = pdfConverter.GetPdfBytesFromHtmlString(html);

It works fine if loading stylesheet from http. And on another IIS the stylesheet can be read from SSL.

I have no idea about how to troubleshoot this. Can it be a DNS issue?


回答1:


The reason was that SSL 3.0 was disabled on the server and versions of EVO HTML to PDF converter lower than 4.0 don’t have full support for TLS and therefore might not work properly on all the servers when accessing HTTPS documents or resources. This can lead to errors, missing images and styles if those resources are referenced by HTTPS URLs in HTML document.




回答2:


you can try download pdf viewer from chrome store. it's working ready for ssl pdf and it's working for me.

Display pdf in iframe using ssl/https based




回答3:


I experienced this issue after moving a site to a new web server. I was advised by the support team at EvoPdf to change my CSS reference to hit it by IP:

Dim csspath As String = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/") + "Styles/MyStyles.css"
Dim rootIP As String = System.Net.Dns.GetHostEntry(Request.Url.Host).AddressList(0).ToString()
csspath = csspath.Replace("mydomain.com", rootIP)

It's certainly a workaround, but after being unable to locate the source of the issue on the web server or in IIS, this resolved the issue.



来源:https://stackoverflow.com/questions/30260349/pdf-conversion-suddenly-fails-if-reading-stylesheet-from-ssl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!