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. Image for the cookie policy date

HTML to PDF - Error When Deploying on Server "Could not load file or assembly Syncfusion.Compression.Base"

Hi. I created an application which uses Syncfusion's HTML to PDF conversion libraries. Everything works as expected on my dev machine.
But when I published the project, I am getting assembly error.

I even referred to the article here: https://www.syncfusion.com/kb/8841/how-to-publish-html-to-pdf-converter-to-server
But no luck.
I do see that there are no assmbly entries in he web.config file.
Here's the error I am getting:

Could not load file or assembly 'Syncfusion.Compression.Base, Version=17.3450.0.14, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)",
    "Exception": "System.IO.FileLoadException: Could not load file or assembly 'Syncfusion.Compression.Base, Version=17.3450.0.14, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' or one of its dependencies. 
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)\rFile name: 'Syncfusion.Compression.Base, Version=17.3450.0.14, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89'\r   at 
Syncfusion.Pdf.Compression.PdfZlibCompressor.Compress(Stream inputStream)\r   at Syncfusion.Pdf.Compression.PdfZlibCompressor.Compress(Byte[] data)\r   at Syncfusion.Pdf.Primitives.PdfStream.CompressContent(IPdfWriter writer)\r   at Syncfusion.Pdf.Primitives.PdfStream.Save(IPdfWriter writer)\r   at Syncfusion.Pdf.IO.PdfArchiveStream.Save(IPdfWriter writer)\r   at Syncfusion.Pdf.IO.PdfCrossTable.DoSaveObject(IPdfPrimitive obj, PdfReference reference, PdfWriter writer)\r   at Syncfusion.Pdf.IO.PdfCrossTable.SaveArchives(PdfWriter writer)\r   at Syncfusion.Pdf.IO.PdfCrossTable.Save(PdfWriter writer)\r   at Syncfusion.Pdf.PdfDocument.Save(Stream stream)\r   at RuleEngine.RunActionResponse(Nullable`1 clientId, Nullable`1 loanId, CustomRuleQuery customQuery,) in D:\\CNG\\RuleEngine.cs:line 2415\r\rWRN: Assembly binding logging is turned OFF.\rTo enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1.\rNote: There is some performance penalty associated with assembly bind failure logging.\rTo turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog].\r"

9 Replies

GK Gowthamraj Kumar Syncfusion Team December 18, 2019 09:50 AM UTC

Hi Johnny, 

Thank you for using Syncfusion products. 

We suspect that the reported exception might be due to mismatched product version of Syncfusion assemblies. So, we request you to refer the same product version of Syncfusion assemblies to resolve this issue. Kindly refer the below KB link, 
 
If you have already installed the Syncfusion assemblies in your server machine, kindly remove those assemblies in your machine and GAC location, then install the required version assemblies to avoid version conflicts. Please refer the below links for removing the assemblies from GAC, 

Can you please let us know which NuGet package, you are using for converting HTML to PDF, Kindly refer below KB link for converting HTML to PDF from NuGet package.  

If still you are facing the same exception, we can have the web meeting to directly look into the issue on your server and provide the solution at the earliest. Please let us know your availability for web meeting, we will make every effort to have this scheduled on a time of your convenience. 

Regards, 
Gowthamraj K 



JO johnny December 18, 2019 01:31 PM UTC

Hi Gowthamraj,

Thank you for the detailed response.
From the first two links, I assume that I need to have the Syncfusion Essential Studio installed on the prod server. Is that correct?
I had just installed it on my local machine and I hoped that required DLLs in the bin folder will be enough for the processing on prod server.
I am using the Blink engine for converting HTML to PDF and I have correctly added the folder to the published project folder.

I did not download HTML to PDF from Nuget. I installed HTML Converter as shown in docs here.

If I need to install the complete package (Studio and Converter) on server, that would be weird. Otherwise we can connect via web meeting.


PV Prakash Viswanathan Syncfusion Team December 19, 2019 07:32 AM UTC

Hi Johnny, 

There is no need to install Essential studio or HTML converter in server, you can install and get the required assemblies/files from the local machine. Kindly ensure all the Syncfusion assemblies are in same version on your server. Please refer below screenshot, 

 

If still you are facing the same issue, then we can have the web meeting to directly look into the issue on your server and provide the solution at the earliest. Please let us know your availability for web meeting, we will make every effort to have this scheduled on a time of your convenience. 

Regards, 
Prakash V 



JO johnny December 19, 2019 08:47 AM UTC

Hi.
The versions seem to be in order for all 3 DLLs.
I am available between 6am and 1pm GMT. Please let me know how we can connect. I can connect today too.



PV Prakash Viswanathan Syncfusion Team December 19, 2019 10:43 AM UTC

Hi Johnny, 

Thank you for the update.  

It seems, you are using Syncfusion.Compression.Base.dll with 17.3460.0.14 and other libraries with 17.3450.0.14. Can you please try the conversion with exact same version of the assemblies and let us know the result.   

Regards, 
Prakash V 



JO johnny December 19, 2019 11:20 AM UTC

Hi Prakash,
Thank you for pointing that out to me. I don't know what tricks my mind is playing on me, but I did not even register the version change.
Deploying the correct DLL version worked. :)

An issue though: After I changed the reference in Visual Studio, the version was showing as 17.3450.0.14, but when I published, the DLL version was still 3560.
I had to manually change the DLL form Syncfusion installation path to get it to work.


PV Prakash Viswanathan Syncfusion Team December 20, 2019 05:13 AM UTC

Hi Johnny, 

Thank you for the update.  

Regarding the version issue on deployment, kindly try clean/rebuild the solution and try publishing with new publish folder. If still the same issue occurs, the assembly may refer the from the GAC location based on the application target framework. Kindly uninstall the all the Syncfusion assemblies from GAC location on your local machine and refer the assemblies from particular folder, then deploy it to the server.  

Please let us know if you need any further assistance on this.  

Regards, 
Prakash V 



AA Abdul Akher replied to Gowthamraj Kumar January 14, 2021 05:42 AM UTC

Hi Johnny, 

Thank you for using Syncfusion products. 

We suspect that the reported exception might be due to mismatched product version of Syncfusion assemblies. So, we request you to refer the same product version of Syncfusion assemblies to resolve this issue. Kindly refer the below KB link, 
 
If you have already installed the Syncfusion assemblies in your server machine, kindly remove those assemblies in your machine and GAC location, then install the required version assemblies to avoid version conflicts. Please refer the below links for removing the assemblies from GAC, 

Can you please let us know which NuGet package, you are using for converting HTML to PDF, Kindly refer below KB link for converting HTML to PDF from NuGet package.  

If still you are facing the same exception, we can have the web meeting to directly look into the issue on your server and provide the solution at the earliest. Please let us know your availability for web meeting, we will make every effort to have this scheduled on a time of your convenience. 

Regards, 
Gowthamraj K 


Hi,
I am using below simple codes to generate pdf with url as well as html string.
both generating pdf well in development machine but when deploying to server, error coming as "access denied"

HtmlToPdfConverter converter = new HtmlToPdfConverter();
WebKitConverterSettings settings = new WebKitConverterSettings();
settings.TempPath = $"{Directory.GetCurrentDirectory()}{@"\wwwroot\temp"}";
settings.WebKitPath = Path.Combine(_honstingEnvironment.ContentRootPath, "QtBinariesDotNetCore");
converter.ConverterSettings = settings;
//string htmlText = "<html><body><img src=\"Bloom_Logo_Icon.png\" alt=\"Bloom_logo\" width=\"200\" height=\"70\"><p> <h1>Hello World</h1></p>"+strHtml + "</body></html>";          
//string baseUrl = $"{Directory.GetCurrentDirectory()}{@"\wwwroot\images"}";
//PdfDocument document = converter.Convert(htmlText, baseUrl);
PdfDocument document = converter.Convert(http://bloom/emp/Empcourse);
MemoryStream ms = new MemoryStream();
document.Save(ms);
document.Close(true);           
ms.Position = 0;
fileStreamResult = new FileStreamResult(ms, "application/pdf");
fileStreamResult.FileDownloadName = "Sample.pdf";
return fileStreamResult;

***I am using QtBinariesDotNetCore folder under my project directory - under core 2.0.
all files copying to server while deploying.
I can see QtBinariesDotNetCore folder and Syncfusion.HtmlConverter.Portable.dll, Syncfusion.Pdf.Portable.dll and Syncfusion.Compression.Portable.dll under my project directory in server

any advice please?




GK Gowthamraj Kumar Syncfusion Team January 14, 2021 01:06 PM UTC

Hi Abdul, 
 
Thank you for contacting Syncfusion support. 
 
The access denied exception may occurs due to the permission restriction on temporary folder. WebKit HTML converter internally creates and launches a surrogate process from a temporary folder. So, the converter required read/write and execute permission of the temporary folder. If the temporary folder does not have the elevated permission, the reported exception may occurs. So, kindly ensure the respective user group has the permission for the temp folder.  

However, we can provide a particular path as temp path which has the elevated permission using TempPath property in WebKitConverterSettings then the converter will make use of system temporary folder for creating temporary files.  

If the application is hosted on IIS, then make sure the temp folder has read/write/execute permission of IIS_IUSRS user group. Also, kindly try the conversion with Local System identity and let us know the result.  

Kindly make sure that you are using Syncfusion assemblies and QtBinaries from same version of HTML converter installer or NuGet package.  

Kindly check the Syncfusion.HtmlConverter.Base.dll is blocked or not, if it is blocked please try the conversion after unblock it.  

Please refer below link for more information.  

Kindly try the above suggestions and if still the same exception occurs, kindly let us know the details about your server environment such as OS, Bit version, culture settings, RAM etc., so that we can try the conversion in same environment.  
 
Regards, 
Gowthamraj K  


Loader.
Live Chat Icon For mobile
Up arrow icon