Dear community,
since 2 hours im trying to load an pdf through stream or local file into my pdf viewer.
everytime im getting an exception: "The given key was not present in the dictionary".
This exception occurs when im executing following method "var output = helper.ProcessPdf(jsonResult);"
My View:
@using Syncfusion.JavaScript.PdfViewerEnums
@{
ViewBag.Title = "Rechnungsansicht";
}
<h2>Rechnungsansicht</h2>
@Html.EJ().PdfViewer("invoicePdfViewer").ServiceUrl("/Invoice").PdfService(PdfService.Local);
My Controller action:
public object PostViewerAction(Dictionary<string, string> jsonResult)
{
if (Request?.UrlReferrer != null)
{
var invoiceIdStr = HttpUtility.ParseQueryString(Request.UrlReferrer?.Query)["invoiceId"];
if (string.IsNullOrEmpty(invoiceIdStr))
throw new Exception("Rechnung nicht gefunden!");
var invoiceId = Convert.ToInt32(invoiceIdStr);
var helper = new PdfViewerHelper();
//var t = new Thread(GetInvoicePdf);
//t.SetApartmentState(ApartmentState.STA);
//t.Start(invoiceId);
//t.Join();
helper.Load(@"C:\tmp\R000001.pdf");
var output = helper.ProcessPdf(jsonResult);
var response = JsonConvert.SerializeObject(output);
return response;
}
return null;
}
Please help me!
Thanks!
Regards,
Andre