PDFViewer from Memory Stream

2 posts, 0 answers
  1. David
    David avatar
    1 posts
    Member since:
    Nov 2017

    Posted 30 Nov 2017 Link to this post

    I just can't seem to get my PDF to load. I amcreating a RadFixedDocument.

    If I export it to a file, and load it to the viewer, it works just fine:

    using (var stream = File.OpenWrite(resultFile))
     {
        PdfFormatProvider provider = new PdfFormatProvider();
        provider.Export(pdf, stream);
     }
     pdfXactReport.LoadDocument(resultFile);

     

    Seems like this should work, what am I missing??

    using (var saveToMS = new MemoryStream())
    {
        PdfFormatProvider provider = new PdfFormatProvider();
        provider.Export(pdf, saveToMS);
        pdfXactReport.LoadDocument(saveToMS);
    }
  2. Dimitar
    Admin
    Dimitar avatar
    2246 posts

    Posted 01 Dec 2017 Link to this post

    Hello David,

    Remove the "using" statement because it will dispose of the stream. The stream is required because the pages are loaded on demand.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top