We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PDF Viewer Service (asp.net core 3.0): Syncfusion.EJ2.PdfViewer.Load returns "Object reference not set to an instance of an object."

Hi.

I am trying to get the <ejs-pdfviewer> working. It works with your backend but now I am struggling with creating my own PDF Viewer Service. I took the code from here (https://ej2.syncfusion.com/documentation/pdfviewer/how-to/create-pdfviewer-service/) and use it in a ASP.NET Core 3.0 WebApi project.
However, when my Angular SPA attempts to load the document, Syncfusion.EJ2.PdfViewer.Load returns "Object reference not set to an instance of an object." instead of a real JSON object:



What can I do to successfully serve my PDF to the SPA?


Kindest regards
Manuel

Attachment: DMS2209.Backend_f6808d77.zip

9 Replies

AA Akshaya Arivoli Syncfusion Team October 9, 2019 09:42 AM UTC

Hi Manuel , 

Thank you for contacting Syncfusion support. 

We have analyzed the provided details and found that you are using the ASP.NET MVC code snippet in .Net Core project. Please find the below KB to create the PDF Viewer Web service project in ASP.NET Core  


We have also created the sample for the same and shared in the following location, 


Please try this and revert us with more details and modified sample if you are still facing the issue. These details will be helpful for us to investigate more on your issue and assist you better. 

Regards, 
Akshaya 



SA Sandeep October 24, 2019 12:18 PM UTC

Hi, I am using Angular 8, API is working fine but pdf always showing loading spin. 


AA Akshaya Arivoli Syncfusion Team October 25, 2019 10:45 AM UTC

Hi Sandeep,
Based on the provide details we suspect that the reported error occured due to any of the following reasons, 
  • Script and NuGet of different version might be referred, if so kindly use both the Scripts (@syncfusion/ej2-angular-pdfviewer) and the NuGet packages of same version in your project to avoid conflicts.
  • Script error may be thrown so the PDF document is not rendered, if so please provide the error details
  • Provided document may not be available in the location specified in GetDocumentPath()
We have also created simple PDF Viewer sample and shared in the below location, 



Please try this and revert us with the error details, modified sample, replication procedure and Syncfusion version, if you are still facing the issue. These details will be helpful for us to investigate more on your issue and assist you batter. 

Regards, 
Akshaya 



TP Thejas p December 24, 2019 12:14 PM UTC

i am aslo facing same problem in mvc  please help me


AA Akshaya Arivoli Syncfusion Team December 30, 2019 12:34 PM UTC

Hi Thejas, 

Thank you for using Syncfusion products. 

We are unable to reproduce the reported issue with the provided details. We have created simple PDF Viewer sample in MVC and shared the same in the following location,  


Please try this and revert us with more details about your issue, Essential Studio version and modified sample if you are still facing the issue. These details will be helpful for us to investigate further and assist you better. 

Regards, 
Akshaya 



TP Thejas p January 1, 2020 07:13 AM UTC

Hi its working fine now.but pdf form filling is not working in your sample project .when i fill all text box of pdf form  and i am getting empty pdf form not filled one when i downloaded, can u help me please.


AA Akshaya Arivoli Syncfusion Team January 2, 2020 07:35 AM UTC

Hi Thejas, 

Sorry for the inconvenience caused. Json objects to download the form fields were not included in the provided sample, so the form fields are not preserved during downloading. We have updated the Controller code and shared the modified sample in the below link, 


Please try this and revert us with the more details and modified sample if you still have any concerns on this. 

Regards, 
Akshaya 



CG Carlos gutierrez replied to Akshaya Arivoli December 2, 2020 01:25 AM UTC

Hi Thejas, 

Sorry for the inconvenience caused. Json objects to download the form fields were not included in the provided sample, so the form fields are not preserved during downloading. We have updated the Controller code and shared the modified sample in the below link, 


Please try this and revert us with the more details and modified sample if you still have any concerns on this. 

Regards, 
Akshaya 


I am Having a similar problem, does this works with .net core 3.1? because all your codes refers to .net core 2.0, and I have not found info about support of this version
Thanks!


AA Akshaya Arivoli Syncfusion Team December 2, 2020 12:17 PM UTC

Hi Carlos, 

Thank you for your update. We can create the PDF Viewer web service project in ASP.Net Core 3.0. Refer to the below KB for more details, you can also find the sample at the end of the KB, 


Note:  

Before ASP.NET Core 3.0, the default JSON formatters implemented using the Newtonsoft.Json package. In ASP.NET Core 3.0 or later, the default JSON formatters are based on System.Text.Json. Support for Newtonsoft.Json based formatters and features is available by installing the Microsoft.AspNetCore.Mvc.NewtonsoftJson NuGet package and configuring it in Startup.ConfigureServices. 

Kindly try it and revert with more details about your issue and the modified sample if you still have concerns. These details will be helpful for us to investigate further and assist you better. 

Regards, 
Akshaya  


Loader.
Live Chat Icon For mobile
Up arrow icon