How to disable and hide the Select Files and Drag and Drop part of the PDFViewer component?

1 Answer 460 Views
FileSelect PDFViewer
Ben
Top achievements
Rank 1
Veteran
Ben asked on 20 Oct 2023, 03:02 PM

Hi,

I want to disable and hide the marked part of the PDFViewer component.

 

How can i do that?

Thanks,

Ben

1 Answer, 1 is accepted

Sort by
1
Hristian Stefanov
Telerik team
answered on 23 Oct 2023, 02:18 PM

Hi Ben,

To remove the marked part from the PDFViewer, you can use the following CSS style:

<style>
    .k-pdf-viewer-pages .k-icon-xxxl,
    .k-pdf-viewer-pages .k-upload {
        display: none;
    }
</style>

<TelerikPdfViewer Data="@PdfSource"
                  OnDownload="@OnPdfDownload"
                  Height="600px">
</TelerikPdfViewer>

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

    private async Task OnPdfDownload(PdfViewerDownloadEventArgs args)
    {
        args.FileName = "PDF-Viewer-Download";
    }

    protected override void OnInitialized()
    {
        PdfSource = Convert.FromBase64String(PdfBase64);

        base.OnInitialized();
    }

    private const string PdfBase64 = "";
}

Regards,
Hristian Stefanov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
John
Top achievements
Rank 2
Iron
Iron
Iron
commented on 21 Oct 2024, 05:38 PM

I also had to add the class ".k-dropzone-hint" to style to get rid of the text "Drag and drop files here to upload".
Hristian Stefanov
Telerik team
commented on 22 Oct 2024, 12:58 PM

Hi John,

Thank you for sharing your additions to the example so other developers can benefit from this.

Kind Regards,

Hristian

Tags
FileSelect PDFViewer
Asked by
Ben
Top achievements
Rank 1
Veteran
Answers by
Hristian Stefanov
Telerik team
Share this question
or