问题
I have had some long standing code which has worked fine for quite some time. Recently it began generating the following error. 1st on a asp site and later on a .Net MVC site. Neither of which have changed. I really curious as to why the this error now is rising. I am hoping this post will be of use to someone in the future since the solution was difficult to find searching the error itself.
Error: ABCpdf error '80070000' Unable to render HTML. Unable to get printer device-mode size. Microsoft XPS Document Writer Windows error 5. Access is denied.
Some research suggest that it is because the xps writer is not installed but this was not the case or that permissions were set up incorrectly.
回答1:
http://www.websupergoo.com/support.htm# Support issue 6.7 number 4. Add the line below to the object and it worked.
Doc.SetInfo(0, "HostWebBrowser", "0");
This did the trick in both cases.
Just FYI, I think the ABCPdf 8.1 release addressed this issue.
回答2:
Have you got the new version of ABCpdf 8?
As with older versions they use the IE rendering engine, if you upgrade the server/machine which is running ABCpdf to IE8 or higher abc pdf no longer have access to the rendering engine and will produce some very very odd results.
With 8 and above I have found the most consistence rendering is gained by changing the rendering engine used
theDoc.HtmlOptions.Engine = EngineType.Gecko;
this means youi are also not using IE which can only be a good thing.
回答3:
We had this issue at work after some server updates. I resolved the problem by going to printers on the server and deleting the Microsoft XPS printer.
As soon as it was removed our PDF rendering came back!
Hope this helps!
来源:https://stackoverflow.com/questions/8015561/why-did-abcpdf-code-start-generating-a-window-error-5