Using PDF Component on Windows and Linux

Hello. I'm trying to use the PdfViewer component to render a PDF document to an image file in a .NET Core 3.1 app. I referenced the Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows package and all works well on my local Windows 10 dev machine. When I deploy to my Linux Ubuntu 18.04 Azure server, it doesn't work. I've seen some threads talking about this issue, such as this one:


And basically it seems I need to use Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux for the linux machine. However, I have a couple questions. First, when I actually publish my app locally on Windows, I don't see Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.dll in the published files. I see these:

Syncfusion.Compression.Portable.dll
Syncfusion.EJ2.PdfViewer.dll
Syncfusion.Licensing.dll
Syncfusion.Pdf.Portable.dll

For some reason I don't see Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.dll at all... which really surprised me because in my Visual Studio solution, I can see it under packages "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows (18.1.0.46)."

I assumed I would see that DLL in the published output and I could just swap that one file for the linux deployment but that file isn't there so I'm not sure what to do. Is this expected? From your other threads I know I can't put both libraries in the same project... Is there a best practice for how to do dev in Windows and deploy to linux for this library?

6 Replies

AA Akshaya Arivoli Syncfusion Team May 4, 2020 12:25 PM UTC

Hi Brent, 

Thank you for contacting Syncfusion support. 

We need to install the Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux  package in your project to work in Linux platform. Please find the below link to work with EJ2 PDF Viewer server library export as image functionality. We need to install the linux package and build and run the same in the Linux environment. 


In our EJ2 PDF Viewer server library , we are using the PDF Base, Compression and Licensing packages internally so those packages installed while installing Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows packages. 

Please try it and revert us with more details about your requirement if you still need any assistance. These details will be helpful for us to investigate further and assist you better. 


Regards, 
Akshaya. 




BR Brent May 4, 2020 02:19 PM UTC

Thanks for the reply. So, I have three specific questions:

1. I don't see "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.dll" in the published build folder.  Is "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows" just the nuget package name and it includes "Syncfusion.EJ2.PdfViewer.dll" for Windows i.e. there is no "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.dll?"

2. So, is the Windows and Linux-specific code in two versions of Syncfusion.EJ2.PdfViewer.dll?  Can I just publish everything on Windows and then swap that one file for the Linux deployment? 

3. I assumed I could build/publish on Windows and deploy to Linux (as described in #2).  Do I need a separate Linux "build server?"


AA Akshaya Arivoli Syncfusion Team May 5, 2020 11:34 AM UTC

Hi Brent, 

Thank you for your update. 

Please find the details of your query from the below, 

Query 
Details  
 I don't see "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.dll" in the published build folder.  Is "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows" just the nuget package name and it includes "Syncfusion.EJ2.PdfViewer.dll" for Windows i.e. there is no "Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.dll?" 
Yes the “Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows”is NuGet name and it includes  "Syncfusion.EJ2.PdfViewer.dll" 
So, is the Windows and Linux-specific code in two versions of Syncfusion.EJ2.PdfViewer.dll?  Can I just publish everything on Windows and then swap that one file for the Linux deployment?  
No, we need to use the Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux  package in your project then build it in Linux environment and then publish the same 
I assumed I could build/publish on Windows and deploy to Linux (as described in #2).  Do I need a separate Linux "build server?" 
No, we cannot use the build/ publish on Widows in Linux platform. We need to build the project in Linux environment and then publish the same  


Regards, 
Akshaya 



GE Gerard April 15, 2022 01:31 PM UTC

FWIW, for my struggling developer congeners, here's how I solved it in a .NET Core Blazor project:

Downloaded the pdfium files from here: https://blazor.syncfusion.com/documentation/pdfviewer/how-to/unexpected-token. Added a folder "Assets" to the root of my Blazor web project and added this to my .csproj:







Also, since I build with Azure Devops on a Ubuntu linux machine (and deploy to an Azure linux stack), I have this in the .csproj:





KZ kzolnierz replied to Gerard January 9, 2023 01:46 PM UTC

Hi Gerard,


I'm having a similar problem with this thread. I would like to support PDF Viewer for Windows as well as Linux. So I added 2 dlls - Syncfusion.Blazor.PdfViewerServer.Windows and Syncfusion.Blazor.PdfViewerServer.Linux.


Unfortunately when running my Blazor solution on my machine (Windows) the viewer doesn't work - I suspect it's because of adding the Linux package.


Unfortunately I can't see your code, so could you re-share your solution?



VV Visvesvar Venkatesan Syncfusion Team January 10, 2023 03:45 PM UTC

We cannot use both the windows package and the Linux package at the same.


Kindly install the respective package according to your environment.


Kindly revert to us if you still have any issues after installing the respective package alone.


Kindly find the forum for reference :

https://www.syncfusion.com/forums/178323/issue-with-having-both-pdfviewerserver-windows-and-pdfviewerserver-linux-installed



Loader.
Up arrow icon