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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Platform: WinForms |
Control: PDF |
Published Date: March 3, 2015 |
Last Revised Date: March 5, 2015
Tags: pdf, htmltopdf, 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#

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon