How to fix the ThreadStateException (ActiveX control cannot be instantiated) exception when converting HTML to PDF?
In the HTML to PDF conversion process, the HTMLConverter throws an exception with the message "ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."
The HTMLConverter internally makes use of the MSHTML.dll that can run only in the STA mode. Running the application in the MTA mode leads to this exception.
This can be fixed by any of the following ways:
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
|6394||02/25/2016||02/25/2016||ASP.NET Web Forms|