Problem loading a pdf dynamically via the event created

Hello,

I have a problem with loading a pdf dynamically via the event created like this :

  <SfPdfViewerServer @ref="PdfViewer" Height="500px" Width="1060px"> <PdfViewerEvents Created="DocumentLoad"></PdfViewerEvents> </SfPdfViewerServer>
@code{
    public SfPdfViewerServer PdfViewer { get; set; }
    public void DocumentLoad()
    {
        byte[] byteArray = System.IO.File.ReadAllBytes("wwwroot/Data/PDF_Succinctly.pdf");
        string base64String = Convert.ToBase64String(byteArray);
        PdfViewer.Load("data:application/pdf;base64," + base64String, null);
    }
}

With the "clasical method (serveur load pdf)  it's works with the same pdf but with the method on the top it's crash with message pdf corrupted.

I send you a sample to reproduce. On the left menu you have 2 menu that interresting you :

PDF Viewer6 Rectangle => pdf load by server works
PDF Viewer7 Bug pdf => load dynamically crash 

Both load the same pdf.

Thanks,
Nicolas

Attachment: BlazorAppPOC__Cas_HL_BUG_load_pdf_APRR_a275d060.zip

3 Replies 1 reply marked as answer

NN Nicolas NOEL March 16, 2021 10:52 AM UTC

Prints screen  :








VS Vasugi Sivajothi Syncfusion Team March 17, 2021 08:58 AM UTC

Hi Nicolas, 
 
We were able to reproduce the reported issue with the provided sample. We will analyze further on this and update you with more details on March 19, 2021. 
  
 
Regards, 
Vasugi 



VS Vasugi Sivajothi Syncfusion Team March 19, 2021 04:19 PM UTC

 
Hi Nicolas, 
 
We have checked with the provided sample, we suspect that the reported issue is due to invalid file name and byte array value. The given filename contains the “#” value so the GetByteArrayAsync() method returns the wrong data. We suggest you use rename or modified the file path to resolve the reported issue in your end.  Please find the modified sample from the below link. 
Note: The PDF document file should be placed in this location (Sample/Client/wwwroot/filename.pdf) 
 
Regards, 
Vasugi 


Marked as answer
Loader.
Up arrow icon