PdfRenderer.ReferencePath = _hostingEnvironment.WebRootPath + "\\" |
public IActionResult Load([FromBody] Dictionary<string, string> jsonObject)
{
PdfRenderer pdfviewer = new PdfRenderer(_cache);
PdfRenderer.ReferencePath = _hostingEnvironment.WebRootPath + "\\";
MemoryStream stream = new MemoryStream();
object jsonResult = new object();
if (jsonObject != null && jsonObject.ContainsKey("document"))
{
if (bool.Parse(jsonObject["isFileName"]))
{
string documentPath = GetDocumentPath(jsonObject["document"]);
if (!string.IsNullOrEmpty(documentPath))
{
byte[] bytes = System.IO.File.ReadAllBytes(documentPath);
stream = new MemoryStream(bytes);
}
else
{
return this.Content(jsonObject["document"] + " is not found");
}
}
else
{
byte[] bytes = Convert.FromBase64String(jsonObject["document"]);
stream = new MemoryStream(bytes);
}
}
jsonResult = pdfviewer.Load(stream, jsonObject);
return Content(JsonConvert.SerializeObject(jsonResult));
} |
<SfPdfViewer DocumentPath="PDF_Succinctly.pdf" ServiceUrl="https://ej2services.syncfusion.com/production/web-services/api/pdfviewer" Height="500px" Width="1060px" ></SfPdfViewer>
|
Query |
Details | ||
Word Document |
Set below property to “true” to restrict editing inside the document editor.
Set below property in the created event to disable print, sfdt export, word export.
| ||
Pdf Document |
We can disable the Download and Print functionalities of the PDF Viewer using the ToolbarSettings API. Refer to the below code and sample for the same,
|