Search results

Unload the PDF document from Viewer in Blazor PDF Viewer component

The PDF Viewer component will automatically unload and clear the resources occupied by the PDF document when the control is disposed. Also, when loading another PDF file, the resources occupied by previous loaded file in viewer will be automatically unloaded and cleared.

If you want to unload and clear the resources occupied by the PDF file programmatically, invoke the Unload() method as shown below.

@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.PdfViewerServer

<SfButton @onclick="OnClick">Unload Document</SfButton>
<SfPdfViewerServer @ref="@viewer" Height="500px" Width="1060px" DocumentPath="@DocumentPath" />

@code{
        SfPdfViewerServer viewer;
        public void OnClick(MouseEventArgs args)
        {
            viewer.Unload();
        }
    public string DocumentPath { get; set; } = "wwwroot/data/PDF_Succinctly.pdf";
}