Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "Qt: Could not initialize OLE (error 80070005)" issue

I am using Rotativa to generate PDF in my Application. It's working fine in my application localhost (Development). I got the "Qt: Could not initialize OLE (error 80070005)" error once, i have deployed in my server. How to solve this issue. Thanks advance

like image 577
saravanan Avatar asked Aug 26 '16 09:08

saravanan


2 Answers

Go to IIS > Site > Authentication, click on "ASP.NET Impersonation" and DISABLE it

like image 54
Joao Leme Avatar answered Nov 14 '22 22:11

Joao Leme


I found the problem here-

https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2782

We started by removing all assets (css and javascript) from the document - leaving just images and the html layout. It generated correctly through IIS. We then slowly added back resources, starting with CSS. The moment we added one of our Javascript files back it threw the OLE error again. We removed that and added some simple Javascript to the document (literally var x = 1;) and it still failed.

For some reson wkhtmltopdf cannot find js files...

so i found the solution here-

https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1634

I simply had to change:
<script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/1.4.5/numeral.min.js"></script>
to:
<script src="http://cdnjs.cloudflare.com/ajax/libs/numeral.js/1.4.5/numeral.min.js"></script>
(added the HTTP).

I also switch on server from ActionAsPdf to UrlAsPdf

And set the url to localhost

string pthx = "http://localhost/Home/exmple?num=" + numtofind;
UrlAsPdf urlss = new UrlAsPdf(pthx) {
    FileName = "REPORT.pdf",
    CustomSwitches = "--print-media-type "
};

I think the wkhtmltopdf can't find host...

Hope it will help you too...

like image 34
Zvi Redler Avatar answered Nov 14 '22 21:11

Zvi Redler