Is there an example of submitting the content of the pdfviewer via javascript from a link on a razor page? I am having trouble submitting an ajax request where the "[FromBody] Dictionary<string, string> jsonObject" parameter isn't null, which I'm sure is because I'm not passing it properly, but I can't seem to find any examples on how to do that.
To provide a bit more detail, if you use the following in javascript:
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewer.download();
It will call this method in the razor page code and populate the jsonObject properly:
public IActionResult OnPostDownload([FromBody] Dictionary<string, string> jsonObject) {
PdfRenderer pdfviewer = new PdfRenderer(_cache);
string documentBase = pdfviewer.GetDocumentAsBase64(jsonObject);
return Content(documentBase);
}
What I would like to do is post the pdfviewer data to a new method that does something else:
public IActionResult OnPostSomethineElse([FromBody] Dictionary<string, string> jsonObject) {
//-- Do something else
}
Any help would be greatly appreciated!