PdfRenderer.ReferencePath = _hostingEnvironment.WebRootPath + "\\"; |
public IActionResult Load([FromBody] Dictionary<string, string> jsonObject)
{
PdfRenderer pdfviewer = new PdfRenderer(_cache);
PdfRenderer.ReferencePath = _hostingEnvironment.WebRootPath + "\\";
MemoryStream stream = new MemoryStream();
object jsonResult = new object();
if (jsonObject != null && jsonObject.ContainsKey("document"))
{
if (bool.Parse(jsonObject["isFileName"]))
{
string documentPath = GetDocumentPath(jsonObject["document"]);
if (!string.IsNullOrEmpty(documentPath))
{
byte[] bytes = System.IO.File.ReadAllBytes(documentPath);
stream = new MemoryStream(bytes);
}
else
{
return this.Content(jsonObject["document"] + " is not found");
}
}
else
{
byte[] bytes = Convert.FromBase64String(jsonObject["document"]);
stream = new MemoryStream(bytes);
}
}
jsonResult = pdfviewer.Load(stream, jsonObject);
return Content(JsonConvert.SerializeObject(jsonResult));
} |
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
export LD_LIBRARY_PATH=/lib64/
libc6-dev \
libgdiplus \
libx11-dev \
curl \
vim \
supervisor \
procps
|
"The type initializer for 'Syncfusion.EJ2.PdfViewer.PdfiumNative' threw an exception."
export LD_LIBRARY_PATH=/lib64/
sudo apt-get update
sudo apt-get install -y --allow-unauthenticated
sudo apt install yum libc6-dev
sudo apt install yum libgdiplus
sudo apt install yum libx11-dev
sudo apt install yum curl
sudo apt install yum vim
sudo apt install yum supervisor
sudo apt install yum procps
|
I am also facing same issue with linux i am unable to render pdf viewer
Find the documentation link on how to resolve the Pdfium issue.
https://ej2.syncfusion.com/aspnetcore/documentation/pdfviewer/how-to/resolve-pdfium-issue
Kindly try this and let us know if this helps.
If you have any concerns in this, you can share the error details, code snippets, and sample in which the issue is reproduced, and also share the network tab response as in the screenshot in a private ticket. We will check and get this resolved soon.
Did any of the steps worked for anyone? I have aws Ubuntu ec2 instance and facing this issue. How come it is not resolved yet. I tried all the steps suggested here and still getting the very same issue.
Could you confirm whether the pdfium dependency is installed in your environment. If it's not installed, please follow the below commands one by one to install the pdfium dependency on your environment and test the scenario once.
sudo apt-get install libfontconfig1 sudo apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev sudo apt-get update sudo apt install libgdiplus |
If you have any concerns, we kindly request that you check and provide the network tab information, as shown in the screenshot below. Additionally, please share the details of the NuGet packages you are using.