Articles in this section
Category / Section

How to display PDFs from byte arrays using Blazor PDF Viewer

2 mins read

 

The Blazor PDF Viewer is a UI component for displaying PDFs from byte arrays, streams, or file paths. In addition to being able to print PDFs, it also supports reviewing PDFs with annotation tools. Thumbnails, bookmarks, hyperlinks, and tables of content provide easy navigation within and outside PDF files. The Form-filling support allows filling and printing with AcroForms.

 

Display PDF from byte arrays

In this Knowledge Base, you can find information about how to display PDF files from byte arrays. The following code sample explains how the PDF file can be loaded in the PDF Viewer as a base64 string.

Refer to the following code sample. 

@using Syncfusion.Blazor.PdfViewerServer
 
<SfPdfViewerServer ID="pdfviewer" DocumentPath="@DocumentPath" Width="1060px" Height="500px"/>
 
@code {
    static byte[] byteArray = System.IO.File.ReadAllBytes("wwwroot/data/PDF_Succinctly.pdf");
    static string base64String = Convert.ToBase64String(byteArray);
    public string DocumentPath { get; set; } = "data:application/pdf;base64," + base64String;
}
 

 

You can refer to this link to learn about how to open PDF files from various locations. Also, please find the following locations.

 

 

Conclusion

I hope you enjoyed learning about how to display PDFs from byte arrays using Blazor PDF Viewer. You can explore the runnable sample of display PDFs from byte arrays using the Blazor PDF Viewer from this GitHub location.

You can refer to our Blazor PDF Viewer feature tour page to know about its other groundbreaking feature representations. You can also explore our Blazor PDF Viewer example to understand how to present and manipulate data.

For current customers, you can check out our Blazor components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our Charts in Blazor and other Blazor components.

If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our support forums

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please  to leave a comment
Access denied
Access denied