Hello Dhivya,
I am sorry for taking so long to reply.
I am creating a Linux container using Docker Desktop with WSL 2 engine (Ubuntu distro) on Windows 10. Also, I have already installed Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux NuGet package for my project and I have checked if this issue is related with write access permission like you mentioned above. However, it isn't. Besides that, I have added the following line of code which should generate us the libpdfium.so every time when PdfViewer Controller receives the request to Load the pdf file:
PdfRenderer.ReferencePath = _hostingEnvironment.WebRootPath + "\\";
Unfortunately, I have noticed that libpdfium.so file is being created in a directory named '\', not in our project's root path. Do you think this might be the main reason that I still get the error "The type initializer for 'Syncfusion.EJ2.PdfViewer.PdfiumNative' threw an exception."?
Best Regards,
Ignacy Mielniczek
|
RUN ln -s /lib/x86_64-linux-gnu/libdl-2.24.so /lib/x86_64-linux-gnu/libdl.so
# install System.Drawing native dependencies
RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev
RUN ln -s libgdiplus.so gdiplus.dll
|
Hi Dhivya,
Thank you very much for a quick response. I am writing to you to inform you that the issue has been resolved by adding the commands which you have sent me above, to our project's DockerFile.
One more time thanks for the help. :)
Best Regards,
Ignacy Mielniczek
Hi,
We are facing the same issue, been working on it for 4 days and we keep on getting the error "JsonResult: The type initializer for 'Syncfusion.EJ2.PdfViewer.PdfiumNative' threw an exception.".
We are not able to access the gitlab link mentioned above btw.
Could you please help please?
Thanks,
Evrard
|
If the Pdfium assembly is available in this path C:\Pdfium\x64 or D:\Pdfium\x86, the reference path should be PdfRenderer.ReferencePath = "C:/";
The parent folder has to be provided as the path in the ReferencePath API.
Note: Provide this path in the Load method of the PDFViewerController.cs
PdfRenderer PdfRenderer = new PdfRenderer();
PdfRenderer.ReferencePath = @"C:/"; |
Hi Guys, I'm using angular ejs-pdfviewer and recently I have updated the package to "20.1.52" and also in the .Net Core updated all the Nuget to this version and also registered the new license key for this version. And, in my local system pdfviewer have worked fine only. But, after the deployment and in the deployed site, I'm getting this error, please check the screenshot for reference here https://prnt.sc/tEh5yas35hGe ., Is there anything to do related to the "PdfiumNative" after updating to the latest nuget packages of the syncfusion? And also FYI, Please check the screenshots related to pdfium in my project below.,
1. https://prnt.sc/n6Tg6YimAA-j --> This is related to the "pdfium" folder referencing in the project (Worked previously, but now getting error in the deployed site.)
2. https://prnt.sc/KZhUlasJ3MGl --> This is related to the syncfusion Nuget package related to the .net core pdfviewer windows
And lastly, for our project, few sites were deployed under the windows environment (they were working fine only) and few sites will get deployed under the Linux environment (in these, it is throwing error). Can you please tell me what to do for this.
Please, provide me a solution for this as this is an important feature in our project.
Hi Sravan,
We suspect that the reported issue in the Linux platform is due to libpdfium.so is not referred on your end. We will create the pdfium based on the operating system at the runtime. So pdfium.dll (libpdfium.so) will be generated on runtime within the project location. We have maintained the separate NuGet packages based on the OS. So, if you deploy the PDF Viewer project on Linux then you must refer to the corresponding NuGet (Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux) to run the PDF Viewer.
Pdfium dll: pdfium.dll
For more information, please refer to the below link.
https://ej2.syncfusion.com/aspnetcore/documentation/pdfviewer/how-to/resolve-pdfium-issue
Kindly try this and let us know if you have any concerns about this.
Regards,
Vasugi.
App version: .Netcore 3.1
I have created a lambda function and trying to convert PDF file to images. Its working fine on my local machine but when i deploy my lambda function to aws it gives error "The type initializer for 'Syncfusion.EJ2.PdfViewer.PdfiumNative' threw an exception."
I have set reference path but still not working.
https://ej2.syncfusion.com/aspnetcore/documentation/pdfviewer/how-to/resolve-pdfium-issue
Above URL help is not working.
Hi Shoaib,
We are analyzing your query and we will provide further details on May 20, 2022.
Regards,
Shamini
Hi shoaib,
Currently, PDF Viewer is not working in the AWS
lambda. We have raised the query in the AWS
forum regarding installing the dependencies in the AWS environment. We will let
you know once we get the update from the forum. You can track the status using
the below feedback link,
https://www.syncfusion.com/feedback/31825/pdf-viewer-not-working-in-aws-environment
Regards,
Vasugi
Hello,
I am facing a similar issue as everything listed above and have tried the following solutions:
- Checking write permissions on Pdfium folder in project
- Setting reference path to Pdfium folder
- Installing listed packages from the Docker solution (my project does not use Docker but I manually installed what was listed)
I am developing on Windows and using the Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows works great with the inclusion of 'Pdfium/x64/pdfium.dll' during local development. However, I am deploying to a Linux environment on AWS Beanstalk and is it there that the pdfium exception occurs. I have temporarily switched to developing on Ubuntu 22.04 to try and debug this issue locally with more control. I have added 'libpdfium.so' to the Pdfium folder and switched to Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux and am unable to get rid of the error.
My target framework is .net 6 and I am using package version 20.4.0.38 for all installed Syncfusion packages. I was previously using .net 7 while developing on windows but switched to .net 6 as an attempt to solve the issue.
Any help on the issue is greatly appreciated.
Thank you,
Andrew
Use the below commands to install the pdfium dependency in Linux machine.
|
sudo cp -u /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so sudo apt-get update sudo apt install libgdiplus
|
If you are still facing the issue after package installation, Please share the below details.
The above step were not resolved the error. Please share the network tab response details to check further.
Hi Chinnamunia,
I did what you suggested on Ubuntu and it worked great!
I am unfortunately unable to replicate this on Amazon linux which is where I am deploying to. I am assuming this has to do with installing the correct native dependencies, and I am wondering how I might satisfy these requirements on Amazon linux. I am running 64bit Amazon Linux 2 v2.5.0. So far I was able to successfully install libgdiplus and made a copy of /lib64/libdl.so.2 as /lib64/libdl.so but have been unable to replicate anything else that was successful for me on Ubuntu.
Thank you.
|
I did what you suggested on Ubuntu and it worked great!
|
We are glad to know the issue is resolved on your end. |
|
|
I am unfortunately unable to replicate this on Amazon linux which is where I am deploying to. I am assuming this has to do with installing the correct native dependencies, and I am wondering how I might satisfy these requirements on Amazon linux. I am running 64bit Amazon Linux 2 v2.5.0. So far I was able to successfully install libgdiplus and made a copy of /lib64/libdl.so.2 as /lib64/libdl.so but have been unable to replicate anything else that was successful for me on Ubuntu.
|
We suspect your query is to add the dependencies in the Amazon Linux environment. If yes, Please add the below Linux dependencies installation command in Amazon Linux environment to install the libgdiplus package.
Please refer the below link also for how to install a software package in Amazon Linux
https://bobcares.com/blog/install-a-software-package-from-the-extras-library-on-ec2/
If you are still facing any issues, Share the network tab and console tab screenshot for the issue and also share the AWS instance details like AWS EKS or Lambda function.
|
Hi,
We recently migrated our project to Angular 17 and during this process, we also upgraded the Syncfusion package. We are using the PDF viewer in one of the modules, and our implementation involves both server-side and client-side rendering.
After analysis, we discovered that the PDF viewer version @syncfusion/ej2-angular-pdfviewer (26.2.10) doesn't support both rendering modes. We rolled back to version 25.2.3, and both rendering modes worked as expected.
However, since our application migration was recent, we cannot revert just the PDF viewer to version 25.2.3. We would like to know if this is a bug or if there’s something we need to do on our end to make version 26.2.10 support both rendering modes.
Any assistance would be greatly appreciated.
I have attached the screenshot of the error we are facing for your reference:
Thanks,
Rahul
Hi Rahul,
We recommend verifying the issue using the latest version of the PDF Viewer package (28.1.41), as this version may have resolved the rendering mode compatibility issue. We have provided a sample for testing below with the mentioned version (26.2.10)
If the issue persists, could you please provide the following details to help us investigate further and offer an accurate solution?
If upgrading to the latest version is not feasible or you face any challenges, please let us know, and we will assist you further.
Sample: Nwdaqob9 (forked) - StackBlitz
Regards,
Priyadharshini