|
Query |
Details |
|
I've been trying to get the PDF Viewer to display a dynamically created PDF.
Here's what happens:
A user selects some data from a table, on the post back the PDF is generated and the user is returned to the PDFViewer View.
I've looked at many of the PDFViewer solutions on this site and have not found one that works for my situation. The main thing is, the PDF is not stored on the file system or in a database, it's to be created, displayed and destroyed.
My View has this creating the Viewer:
@(Html.EJ().PdfViewer("pdfviewer").ServiceUrl("../../api/PdfViewer").PdfService(Syncfusion.JavaScript.PdfViewerEnums.PdfService.Local).DocumentPath(@Model.BaseString))
The Model is based on a class found on this site:
public class PdfBaseString
{
public string BaseString
{
get;
set;
}
}
In the PDF creation method I have the following (finalPDF is a byte[]):
PdfBaseString base64String = new PdfBaseString();
base64String.BaseString = "data:application/pdf;base64," + Convert.ToBase64String(finalPDF);
return View("ViewPdf", base64String);
The view displays, but with the PDFViewer showing a loading spinner.
|
We regret to let you know that we are unable to reproduce the reported issue with the details provided in the incident. We have created the sample with the information and the code snippet provided in the incident and shared the same in following location,
Please try the above sample and revert us with the following details if still the issue is reproduced.
These details will be helpful for us to investigate more on your requirement and assist you better.
|
|
In all the other examples I've found there's always a POST method being used to populate the model, but I will not have a postback on the page. Is that required? How does the PDFViewer load the data? What am I missing? |
The PDF viewer is not fully client side control. The parsing of the PDF documents is performed on the server side of the control in the WebAPI control using the Ajax requests and then the document is rendered on the client side of the PDF Viewer control. Please find the UG documentation link below,
|