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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PDF is not loading on mac

Thread ID:





147053 Aug 30,2019 07:27 AM UTC Sep 3,2019 01:27 PM UTC ASP.NET Core - EJ 2 2
Tags: PDF Viewer
Asked On August 30, 2019 07:27 AM UTC


I'm running a project based on razor pages that uses pdfviewer page and page model. I am running on the mac environment and I use VS community 8.2.5.
I am using the following OnPOSTLoad() for my 

public IActionResult OnPostLoad([FromBody] Dictionary<string, string> jsonObject)
            if (jsonObject == null)
                return this.Content($"{nameof(jsonObject)} is null");

                if (jsonObject.TryGetValue("document", out var fileName))
                    var documentPath = GetDocumentPath(fileName);
                    if (!string.IsNullOrEmpty(documentPath))
                        var pdfRenderer = new PdfRenderer();
                        var jsonResult = pdfRenderer.Load(documentPath, jsonObject);
                        return Content(JsonConvert.SerializeObject(jsonResult));
                        return this.Content(jsonObject["document"] + " is not found");
                    return this.Content($"document is missing in {nameof(jsonObject)}");
            catch (Exception ex)
                return this.Content($"Exception: {ex}");

an exception occurs on line
 var jsonResult = pdfRenderer.Load(documentPath, jsonObject);

following is the exception info:
Message : Object reference not set to an instance of an object.
Source : Microsoft.Extensions.Caching.Abstractions
StackTrace:    at Microsoft.Extensions.Caching.Memory.CacheExtensions.TryGetValue[TItem](IMemoryCache cache, Object key, TItem& value)\n   at Syncfusion.EJ2.PdfViewer.PdfRenderer.Load(String filePath, Dictionary`2 jsonObject)\n   at AHC.BaseTemplate.Areas.CommandCenter.Pages.CareGapManager.GuidelinesModel.OnPostLoad(Dictionary`2 jsonObject) in /Users/mamir/mygit/CC-vNext/AHC.WebApps/Areas/CommandCenter/Pages/CareGapManager/Guidelines.cshtml.cs:line 122

So I have not been able to load the pdf document. I have to mention that this problem does apply when running the code in the windows env and the pdf document loads in windows.

I very much appreciate any help.


Replied On August 30, 2019 10:37 PM UTC


After you mentioned the changes applied to version, I downgraded my asp.net core package to and now it is working! Thank you so much for your help. I really do appreciate it.

Kind Regards,

Akshaya Arivoli [Syncfusion]
Replied On September 3, 2019 01:27 PM UTC

Hi Maral, 

Thank you for your update.  

We can use the PDF Viewer in Razor pages and find the below KB link for the same with updated the code snippet and the sample, 

Please try this and let us know if you have any concerns on this. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon