How to hide download and print button?

1 Answer 8 Views
PDFViewer
Nelson
Top achievements
Rank 1
Nelson asked on 27 Nov 2025, 12:24 PM

Hi all,

I used https://www.telerik.com/blazor-ui/documentation/components/pdfviewer/toolbar to customize my toolbar and it works fine.

So, I need to hide/show Download and Print Buttons according user and kind of report.

How do I hide this buttons inside my blazor code?

 

Regards,

Nelson

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 28 Nov 2025, 07:40 AM

Hi Nelson,

Conditions can be used within the PDFViewer's declaration. Thus, you may use "if" statements to determine whether a button in the toolbar will be rendered or not. For example, you can check the user role like this:

<TelerikPdfViewer Data="@PdfSource">
    <PdfViewerToolBar>
        <PdfViewerToolBarCustomTool>
            <TelerikButton OnClick="@OnPdfCustomClick">Custom PDF Tool</TelerikButton>
        </PdfViewerToolBarCustomTool>

        <PdfViewerToolBarSeparator />

        <PdfViewerToolBarOpenTool />
            
        @* Show Download button only for Admin users *@
        @if (IsUserInRole("Admin"))
        {
            <PdfViewerToolBarDownloadTool />
        }
            
        @* Show Print button only for Admin users *@
        @if (IsUserInRole("Admin"))
        {
            <PdfViewerToolBarPrintTool />
        }

        <PdfViewerToolBarSpacer />

        <PdfViewerToolBarPagerTool />

        <PdfViewerToolBarSpacer />

        <PdfViewerToolBarZoomTool />
        <PdfViewerToolBarSelectionTool />
        <PdfViewerToolBarSearchTool />
    </PdfViewerToolBar>
</TelerikPdfViewer>

Or, if you have saved the report type in a property, you may add a similar condition that, when fulfilled, will result in the button showing up, otherwise it will remain hidden:

@* Show Print button only report type "analysis" *@
@if (ReportType == "analysis")
{
    <PdfViewerToolBarPrintTool />
}


Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PDFViewer
Asked by
Nelson
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or