PDFViewerServer dynamic load doesn't work if control not rendered

I have a page for displaying PDF's but when the page loads it takes a couple of seconds before a blank pdf viewer is visible.  I would like to automatically load the document from a report server but if I do it before the control renders it doesn't do anything.  With a delay in OnAfterRenderAsync it works ok but I would like a more robust solution if the link is slower.   I have attached the page code, any suggestions.

This is the main code:

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await Task.Delay(2500);

        if (TransID != 0)
            LoadDocument();
    }

    private async void LoadDocument()
    {
        if (mbIsDocLoaded == false)
        {
            mbIsDocLoaded = true;

            string newPdf = GetPDFDocTest(TransID);
            DocData = newPdf;
            await PdfViewer.Load(newPdf, null);
        }
    }

Attachment: PDFViewerPage_70a00dd.zip

5 Replies 1 reply marked as answer

AA Akshaya Arivoli Syncfusion Team November 19, 2020 03:59 PM UTC

Hi Tim , 

Thank you for contacting Syncfusion Support. 

We were able to reproduce the reported behavior with the provided details. We will analyze further on it and update you with more details on November 23, 2020 



Regards, 
Akshaya  



SM Selvakumar Murugan Syncfusion Team November 23, 2020 04:48 PM UTC

Hi Tim,


The PDF Viewer component will gets displayed into the view when the entire dependent component gets rendered. So, there will be delay in rendering the PDF Viewer component.   However, we are  currently checking on this with high priority , We will analyse further on this and update you with further details on November 25th, 2020   
Regards,
Selvakumar 



AA Akshaya Arivoli Syncfusion Team November 26, 2020 05:34 PM UTC

Hi Tim, 

We have analyzed your requirement and we will provide the “Expose created an event for PDF Viewer component ” and improve PDF Viewer component rendering time.  The implementation will be included in our weekly NuGet release on 9th  December 2020. You can track the status using the below link 


Regards,  
Akshaya   



AA Akshaya Arivoli Syncfusion Team December 9, 2020 02:50 PM UTC

Hi Tim, 

Sorry for the inconvenience caused.  

The implementation for the reported behavior will not be included in our latest weekly NuGet release. However, we will implement the same and it will be included in our 2020 Volume 4 release which is expected to be rolled out at the end of December 2020 


Regards, 
Akshaya  



AA Akshaya Arivoli Syncfusion Team December 17, 2020 01:24 PM UTC

Hi Tim, 

We have implemented your requirement and the  implementation was included in our Volume 4 release v18.4.0.30. Kindly upgrade to that version to get the implementation. 
Code Snippet:  
<SfPdfViewerServer @ref="@PdfViewer">
<PdfViewerEvents Created="loadDocument"></PdfViewerEvents>
</SfPdfViewerServer> 
@code{
SfPdfViewerServer PdfViewer;
public void loadDocument()
{
PdfViewer.Load("base64string", null);


Our Essential Studio 2020 Volume 4 Release v18.4.0.30, is rolled out and is available for download under the following link. 


   
Blazor Client  
Blazor Sever 
Service side package    
ASP.NET Core :    
     
ASP.NET MVC:    
   
CDN links:   
   

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 

Regards, 
Akshaya 


Marked as answer
Loader.
Up arrow icon