An application I have been developing needed to add professional generation of PDF documents (read: my home-brew translation of HTML to PDF using iTextSharp did not produce decent results). I decided to use ABCpdf which itself uses the MSHTML engine to render HTML and miraculously converts the result to PDF.
The application consists of a web application and a Windows service which both reference a library implementing the HTML generation and the invocation of ABCpdf.
Development and deployment on 32-bit server were successful, but a production system running Windows Server 64-bit caused several errors:
Unable to load DLL ‘ABCpdf8-64.dll’. The specified module could not be found (Exception from HRESULT: 0x8007007E)
This error was caused by the service running in 64-bit mode. (The web application had already been switched to 32-bit only by restricting the application pool to 32-bit execution). After setting the service exe’s “Platform target” property to x86, the error went away.
Cannot activate MSHtml engine. Please refer to documentation for more information.
The solution for this exception is to set the AppPool’s “Load User Profile” property to true in the Advanced Settings dialog.
After applying these settings, PDF generation also executed successfully on the 64-bit machine.