We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

When does COM Exception arise while converting HTML to PDF in Azure?

The HTML to PDF converter makes use of mshtml.dll (IE Rendering Engine) to convert HTML to Vector Images and then the Vector Images are converted to PDF document. So, while hosting in Azure, when the mshtml.dll is not present, then COM exception occurs. To avoid that, refer to this assembly manually and set the CopyLocal to true by using the following code in csproj file.

.csproj

<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

<Private>True</Private>

</Reference>

As IE rendering engine needs elevated permission, it can be hosted only as Cloud service and not as website since Azure websites only have limited permissions.

The COM error may occur when the instances are not properly disposed. The following changes are needed:

  1. Proceed with the HTMLConversion within using statement.
  2. Dispose the PdfDocument instance after conversion.

C#

 

Article ID: Published Date: Last Revised Date: Platform: Control:
4214 03/03/2015 03/05/2015 Windows Forms PDF
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.