Error while creating object for class PdfRenderer

We have ASP.Net project with .Net Framework class library
 
We are upgrading our syncfusion dlls from version 15 to 18

We were using syncfusion for creating and editing word document and converting pdf pages to images.

After upgrade we are getting following error while creating object of class PdfRenderer.

Could not load file or assembly 'System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.


Below are the line of code creating problem after upgrade 
===========================================
 
PdfRenderer loadedDocumentNew = new PdfRenderer(); // Error coming while executing this line
PdfRenderer.ReferencePath = hostPath + "\\";
loadedDocumentNew.Load(path);

for (int i = 0; i < loadedDocumentNew.PageCount; i++)
{
try
{
extractedImage = (Image)loadedDocumentNew.ExportAsImage(i, dpiX, dpiY);
                                   ............
                                   ............

===========================================




Following latest packages are installed 
================================
Syncfusion.DocIO.AspNet.Mvc5
Syncfusion.EJ2.MVC5
Syncfusion.EJ2.PdfViewer.AspNet.Mvc5
Syncfusion.Pdf.AspNet.Mvc5
Syncfusion.XlsIO.AspNet.Mvc5


I have also attached screen shots to explain the error


Attachment: ScreenShotsForError_2aa4344.zip

9 Replies 1 reply marked as answer

AA Akshaya Arivoli Syncfusion Team October 26, 2020 12:19 PM UTC

Hi Devinder, 

Thank you for contacting Syncfusion support. 

We were unable to reproduce the reported issue with the provided details. We have also created the sample for the same and shared in the below link,  


Please try it and revert us with more details about your issue, modified sample with the replication procedure, if you still further assistance.  


Regards, 
Akshaya  



MS Marco Salvatori December 10, 2020 02:50 PM UTC

HI,
i have the same error...
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Impossibile trovare il file specificato.'

I'm using this code too but it creates a blank image for me ...

PdfLoadedDocument loadedDocument = new PdfLoadedDocument(myFileContent);
Image thumb = loadedDocument.ExportAsImage(0, new SizeF(400, 400), true);
Stream streamThumb = ImageUtils.ToStream(thumb, ImageFormat.Png);

solution?
thanks


AA Akshaya Arivoli Syncfusion Team December 11, 2020 08:31 AM UTC

Hi Marco, 

We were unable to reproduce the reported issue with the provided details. We have shared the sample in which we have tried to reproduce the issue in the below link, 


Kindly try it and revert us with more details about your issue, PDF document and the modified sample if you still have concerns. 

Regards, 
Akshaya   



MS Marco Salvatori December 11, 2020 10:32 AM UTC

with this example the creation of thumbnails works but I cannot generate a pdf as in the example (https://help.syncfusion.com/file-formats/pdf/working-with-document)

the error is "Could not load file or assembly 'Syncfusion.Licensing, Version=18.3450.0.53, Culture=neutral, PublicKeyToken=632609b4d040f6b4'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

also does not recognize "new Syncfusion.Drawing.PointF".

I can generate the pdf with the "Syncfusion.Pdf.Net.Core" package but it conflicts with the libraries of the example posted (Syncfusion.Pdf.AspNet.Mvc5, Syncfusion.EJ2.PdfViewer.AspNet.Mvc5)

or one, or the other ...



AA Akshaya Arivoli Syncfusion Team December 14, 2020 12:27 PM UTC

Hi Marco, 

Please find the details of your query below, 

Query 
Details  
with this example the creation of thumbnails works but I cannot generate a pdf as in the example (https://help.syncfusion.com/file-formats/pdf/working-with-document
 
the error is "Could not load file or assembly 'Syncfusion.Licensing, Version=18.3450.0.53, Culture=neutral, PublicKeyToken=632609b4d040f6b4'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" 
 
also does not recognize "new Syncfusion.Drawing.PointF". 
 
We have checked the provided sample on our end, but it is working properly. We were not able to reproduce the exception on our end. The reported exception might be due to a mismatched product version of Syncfusion assemblies. So, we request you to refer to the same product version of Syncfusion assemblies to resolve this issue. Please refer to the below link,  
 
  
For the MVC application, we have to use Syncfusion.Pdf.AspNet.Mvc5 NuGet package, but the package. "new Syncfusion.Drawing.PointF" is available only in the PDF Net Core package. So if you are using the .Net Core platform, kindly install “Syncfusion.Pdf.Net.Core" in your project 
 
I can generate the pdf with the "Syncfusion.Pdf.Net.Core" package but it conflicts with the libraries of the example posted (Syncfusion.Pdf.AspNet.Mvc5, Syncfusion.EJ2.PdfViewer.AspNet.Mvc5) 
Based on the provided details, we suspect that you are using the .Net Core platform, so kindly install the “ Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows” package in your project to export the image using the EJ2 PdfViewer server library. 
 
For Linux and OSX operating systems, use the corresponding libraries as follows: 
·       Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux 
·       Syncfusion.EJ2.PdfViewer.AspNet.Core.OSX 
 
Refer to the below UG link to the export image using the EJ2 PDF Viewer server library 
 
https://ej2.syncfusion.com/aspnetcore/documentation/pdfviewer/how-to/export-as-image/ 
 

Kindly try it and revert us with more details about your issue and the sample, if you still have concerns 
  
Regards, 
Akshaya 


Marked as answer

MS Marco Salvatori December 14, 2020 04:30 PM UTC

in the project I use netcore 2.1 and I have some difficulties in installing the packages. i have problems with nugets dependencies.
i tried to create a new net 5.0 project and it seems the installation is going much better. I hope to migrate to net 5.0 in the next few weeks.
tips?


AA Akshaya Arivoli Syncfusion Team December 15, 2020 01:50 PM UTC

Hi Marco, 

Thank you for your update. Kindly try it and revert us with more details, if any concerns on it. We will wait to hear from you. 

Regards, 
Akshaya 



MS Marco Salvatori December 15, 2020 03:38 PM UTC

Ok. working with netcore 2.1 i had to install 3 other microsoft nuget packages.
now work fine ...
soon i will try to migrate everything to the latest net 5.

thanks


AA Akshaya Arivoli Syncfusion Team December 16, 2020 08:04 AM UTC

Hi Marco, 

Thank you for your update. We will wait to hear from you. 

Regards, 
Akshaya 


Loader.
Up arrow icon