This is a migrated thread and some comments may be shown as answers.

Displaying dynamically created Pdf by Document Processing

1 Answer 407 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Daniel asked on 10 Aug 2020, 11:18 AM

Hey guys, currently I'm struggling with the PDFViewer. 

First of all, I'm building a PDF dynamically in my WebApp.

RadFlowDocument document;

RadFlowDocumentEditor editor;

 
[...]

PdfFormatProvider providerPDF = new PdfFormatProvider();
return providerPDF.Export(document);

 

So I'm not saving the created PDF as a file on the filesystem. Till now I'm only able to download the created file with the action method: 

public ActionResult DownloadTestDocument()
{
      return File(
           new Verleihinfo().Pdf,   // returns the byte array -> providerPDF.Export(document)
           "application/pdf",
           "test.pdf");
}

Now instead of downloading the file I want to show my pdf directely in the PDFViewer on my page, so that user can see and interact with. Is it even possible (preferably in MVC)? 
As far I unterstood here it's only possible to pass an existing pdf-file on the filesystem as a parameter to the PDFViewer. But not a dynamically created file..

Thank you
Daniel

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
answered on 10 Aug 2020, 11:59 AM
Okay, I could solve it. Thanks you anyways!

@(Html.Kendo().PDFViewer()
       .Name("pdfViewer")
       .PdfjsProcessing(pdf => pdf.File(Url.Content(
            Url.Action("DownloadTestDocument", "Home")   // instead a path on filesystem I took the action path
        )))
       .Height(1200)
)
Tags
PDFViewer
Asked by
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or