Hi,
It is possible to display error message return by Load in pdfviewer controller below when 'document' does not exist?
Currently nothing is display on browser. I'm using version (19.2.0.56) as my license expired.
[HttpPost("Load")]
[Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")]
[Route("[controller]/Load")]
public IActionResult Load([FromBody] Dictionary<string, string> jsonData)
{
PdfRenderer pdfviewer = new PdfRenderer(_cache);
PdfRenderer.ReferencePath = _hostingEnvironment.WebRootPath + @"\";
if (jsonData.ContainsKey("document"))
{
object jsonResult = pdfviewer.Load(jsonData["document"], jsonData);
return Content(JsonConvert.SerializeObject(jsonResult));
}
else
{
return Content("Error! Document data not available.");
}
}
Hi,
Please use the below code snippet at your side in the ajax request method and revert to us if u have any concern on this.
Code snippet-
if(response.data == null)
{
alert("pdf file not found");
}
Regards,
Visvesvar k v
Can you please explain more?
This my code in cshtml:
<ejs-pdfviewer id="pdfviewer" enableToolbar="true" style="min-height:450px;height: calc(100vh - 170px)" toolbarSettings="@(new Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings { ShowTooltip = true, ToolbarItems = "PageNavigationTool, MagnificationTool, PrintOption, DownloadOption" })" serviceUrl="../api/PdfViewer"> </ejs-pdfviewer>
<script src="~/lib/syncfusion/ej2.min.js"></script>
<script>
function view(btn) {
var selmemo = $(btn).data('path');
var pdfviewerObj = document.getElementById("pdfviewer").ej2_instances[0];
pdfviewerObj.load(selmemo);
}
</script>
Hi RWEM,
Sorry for the inconvenience. Currently, we are working on this. We will update the details on June 16, 2022.
Regards,
Vasugi.
Hi RWEM,
Sorry for the inconvenience.
We have analyzed to prepare a sample as per your requirement. Unfortunately we couldn’t achieve the requirement as the events are not triggering as expected. We have reported the issue “Display error message if file loading is failed or PDF file path not found in PDF Viewer” and suspect this to be a defect. We will analyze further on this and update you with more details on June 20, 2022.
Regards,
Visvesvar k v
Hi RWEM,
We have confirmed that the reported issue “Display error message if loaded in pdf viewer” is a defect and logged the defect reported for the same. The fix for the issue will be included in our upcoming weekly NuGet release on July 13, 2022. You can track the status using the below feedback link.
Feedback link
https://www.syncfusion.com/feedback/35797/display-error-message-if-load-failed-in-pdfviewer
Regards,
visvesvar k v
Hi RWEM,
Sorry for the inconvenience. The fix for the reported issue was not included in our latest release. However, it will be included in our upcoming weekly release on July 27, 2022.
Regards,
Visvesvar K V
Hi RWEM,
We have fixed the reported issue “Display error message if loaded in pdf viewer” and the fix for the reported issue was included in our latest weekly release v20.2.40. Kindly upgrade to that version to get the issue resolved.
Packages:
CDN:
https://cdn.syncfusion.com/ej2/20.2.40/dist/ej2.min.js
https://cdn.syncfusion.com/ej2/20.2.40/material.css
Regards,
Visvesvar K V