Unplanned
Last Updated: 19 Mar 2025 11:28 by ADMIN
Helmut
Created on: 09 Dec 2022 14:15
Category: PDFViewer
Type: Feature Request
6
Ability to hide the "Select files..." button and the DropZone rendered inside the empty PDF Viewer

Please expose a parameter to show or hide the "Select files..." button inside the empty PDF Viewer.

Currently, a possible workaround is to use CSS. Additionally, you may configure the Toolbar to not include the "Open" tool.

<style>
    .no-open .k-blank-page {
        display: none;
    }

    /* Use these selectors if you want to separately target the upload or the dropzone */
    /* .no-open .k-external-dropzone,
    .no-open .k-upload{
        display: none;
    } */
</style>

<TelerikPdfViewer Data="@PdfSource"
                  OnOpen="@OnPdfOpen"
                  Height="600px"
                  Class="no-open">
    <PdfViewerToolBar>
        <PdfViewerToolBarDownloadTool />
        <PdfViewerToolBarPrintTool />

        <PdfViewerToolBarSpacer />

        <PdfViewerToolBarPagerTool />

        <PdfViewerToolBarSpacer />

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

@code {
    private byte[] PdfSource { get; set; }

    private bool LoaderVisible { get; set; }

    private async Task OnPdfOpen(PdfViewerOpenEventArgs args)
    {
        // Cancel the event for additional precaution in case someone bypasses the CSS and forces the page to show the button and the dropzone.
        args.IsCancelled = true;
    }
}

2 comments
ADMIN
Nadezhda Tacheva
Posted on: 19 Mar 2025 11:28

Hi Helmut and everybody who follows the item,

We recently received an additional request to also remove the DropZone rendered inside the empty PDF Viewer. We've revised it with the team and considered that we will rather handle both scenarios by exposing a NoDataTemplate.

While parameters for configuring the visibility of the "Select files..." button and the DropZone may be useful, they cover only a specific case. A template, on the other hand, will provide much more flexibility and will allow the developer to have full control over what is rendered in an empty PDF Viewer.

I've updated the title of the item to cover both requests.

Regards,
Nadezhda Tacheva
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Roy
Posted on: 09 Jun 2023 11:31

if you don't want users to upload files, the select files button should not be in de contents of the page at all so a user cannot enable it.