Hello ,
I'm currently using angular pdf viewer with .netCore web API controller , Can I insert empty page at the start and the end on the fly inside the loading API .
Or if there any method to add pages on the fly for the angular pdf viewer
My code :
public IActionResult Load([FromBody] Dictionary<string, string> jsonObject)
{
S
Console.WriteLine("Load called");
//Initialize the PDF Viewer object with memory cache object
PdfRenderer pdfviewer = new PdfRenderer(_cache);
MemoryStream stream = new MemoryStream();
object jsonResult = new object();
if (jsonObject != null && jsonObject.ContainsKey("document"))
{
if (bool.Parse(jsonObject["isFileName"]))
{
string documentPath = GetDocumentPath("TEMPLATE_DIR_PATH" + 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));
}
Thanks,
Mohamed