Skip to content

Commit 58715b7

Browse files
Merge pull request #3190 from syncfusion-content/EJ2-837974-pdfium
Added additional details to address the pdfium issue that occurred during the deployment
2 parents a6cae27 + a69a4aa commit 58715b7

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/resolve-pdfium-issue.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ documentation: ug
1313

1414
The issue, “The type initializer for 'Syncfusion.EJ2.PdfViewer.PdfiumNative' threw an exception” is due to the write access permission denied in the environment. The pdfium.dll will be created based on the operating system at the runtime. Due to the denial of permission, the pdfium.dll file couldn't have been created. So, copy the below x64 and x86 folders and paste them inside the folder into your project to resolve the issue or enable the write permission for that folder.
1515

16-
Pdfium dll: [pdfium.dll](https://www.syncfusion.com/downloads/support/directtrac/general/ze/Pdfium1515619754.zip)
16+
Pdfium dll: [pdfium.dll](https://www.syncfusion.com/downloads/support/directtrac/general/ze/Pdfium1334927507.zip)
1717

1818
N> Use both the client and server-side of the same version in your project.
1919
<br/> Ensure whether the pdfium.dll file is created in your project during runtime. Else, place the pdfium assemblies in any of the production environment locations and refer to the path by using the ReferencePath API.
@@ -27,7 +27,7 @@ N> Provide this path in the Load method of the PDFViewerController.cs
2727
N> PdfRenderer PdfRenderer = new PdfRenderer();
2828
<br/> PdfRenderer.ReferencePath = @"C:/";
2929

30-
## Steps to refer the Pdfium.dll
30+
## Steps to refer the PDFium.dll
3131

3232
1. Extract the given file (Pdfium folder) and copy it in the sample’s root directory (parallel to Controllers folder)
3333

@@ -40,10 +40,45 @@ N> You need to refer the ParentFolder up to the x64/x86 folder.
4040

4141
4. Build and publish the application.
4242

43-
Also, install only the package related to that OS, then build and run the project on that platform. For Windows, Linux, and OSX operating systems, use the following corresponding libraries:
43+
Also, install the below package, then build and run the project. This will work on Windows, Linux, and OSX operating systems.
4444

45-
* Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux
46-
* Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows
47-
* Syncfusion.EJ2.PdfViewer.AspNet.Core.OSX
45+
* Syncfusion.EJ2.PdfViewer.AspNet.Core
4846

49-
Following these steps should resolve the issue.
47+
Following these steps should resolve the issue.
48+
49+
## Steps to resolve the PDFium issue in Linux environment
50+
51+
* The issue, “The type initializer for ‘Syncfusion.EJ2.PdfViewer.PdfiumNative’ threw an exception” occurs due to the missing of pdfium dependency in the Linux environment. To resolve this, Execute the following commands one by one to install the pdfium dependency package in the Linux machine.
52+
53+
```
54+
sudo cp -u /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
55+
sudo apt-get update
56+
sudo apt install libgdiplus
57+
```
58+
59+
## Steps to resolve the PDFium issue in docker environment
60+
61+
* The issue, “The type initializer for ‘Syncfusion.EJ2.PdfViewer.PdfiumNative’ threw an exception” occurs due to the missing of pdfium dependency in the docker environment. Please follow the steps below to resolve this issue on docker environment.
62+
63+
64+
If you are using the PDF Viewer with Docker in .NET 6.0 framework, please incorporate the following commands into your Dockerfile to install the pdfium dependency:
65+
66+
```
67+
RUN ln -s /lib/x86_64-linux-gnu/libdl-2.24.so /lib/x86_64-linux-gnu/libdl.so
68+
# install System.Drawing native dependencies
69+
RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev
70+
RUN ln -s libgdiplus.so gdiplus.dll
71+
```
72+
73+
Dockerfile 6.0: [dockerfile](https://github.com/SyncfusionExamples/PdfViewer-Server/blob/master/Dockerfile)
74+
75+
If you are using the PDF Viewer with Docker in .NET 8.0 framework, please incorporate the following commands into your Dockerfile to install the pdfium dependency:
76+
77+
```
78+
RUN ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
79+
# install System.Drawing native dependencies
80+
RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev
81+
RUN ln -s libgdiplus.so gdiplus.dll
82+
```
83+
84+
Dockerfile 8.0: [dockerfile](https://github.com/SyncfusionExamples/PdfViewer-Server/blob/master/Dockerfile_NET80)

0 commit comments

Comments
 (0)