-
Notifications
You must be signed in to change notification settings - Fork 79
Added new kb article pdfviewer-upload-controls-visibility #2739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Tsvetomir-Hr
merged 3 commits into
master
from
new-kb-pdfviewer-upload-controls-visibility-e598577ca4b24e0f95a969e701d5857e
Feb 10, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: How to Hide Upload Component in TelerikPdfViewer | ||
description: Learn how to hide the Upload component in TelerikPdfViewer when loading a PDF file. | ||
type: how-to | ||
page_title: How to Hide Upload Component in TelerikPdfViewer | ||
slug: pdfviewer-kb-hide-upload | ||
tags: pdfviewer, blazor, upload, visibility, enableloadercontainer, hide, dropzone | ||
res_type: kb | ||
ticketid: 1675214 | ||
--- | ||
|
||
## Environment | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td>Product</td> | ||
<td>PdfViewer for Blazor</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Description | ||
|
||
When using the [TelerikPdfViewer](https://docs.telerik.com/blazor-ui/components/pdfviewer/overview) for Blazor, upload controls may still be visible while a PDF file is loading, even if the `EnableLoaderContainer` parameter is set to `false`. | ||
|
||
This knowledge base article also answers the following questions: | ||
|
||
- How to prevent interaction with Upload component while a PDF is loading in TelerikPdfViewer? | ||
- How to hide Upload and DropZone components in TelerikPdfViewer until the PDF file is fully loaded? | ||
- How to use custom CSS with TelerikPdfViewer to hide Upload component? | ||
|
||
## Solution | ||
|
||
To control the visibility of Upload component and its dropzone in the `TelerikPdfViewer` while a PDF is loading, apply custom CSS to hide the upload controls. To achieve that, use the [`OnOpen`](slug://components/pdfviewer/events#onopen) event to apply a CSS class with the required styles that hide the controls until the PDF file is loaded successfully. | ||
|
||
````RAZOR | ||
<TelerikPdfViewer Data="@PdfSource" | ||
Height="600px" | ||
EnableLoaderContainer="false" | ||
OnOpen="@OnPdfOpen" | ||
Class="@PdfClass"> | ||
</TelerikPdfViewer> | ||
<style> | ||
.hide-pdf-upload .k-external-dropzone { | ||
display: none; | ||
} | ||
.hide-pdf-upload .k-upload { | ||
display: none; | ||
} | ||
</style> | ||
@code { | ||
private byte[] PdfSource { get; set; } | ||
private string PdfClass { get; set; } = ""; | ||
private async Task OnPdfOpen(PdfViewerOpenEventArgs args) | ||
{ | ||
//hide Upload component | ||
PdfClass = "hide-pdf-upload"; | ||
} | ||
} | ||
```` | ||
|
||
## See Also | ||
|
||
- [TelerikPdfViewer Overview](slug://components/pdfviewer/overview) | ||
- [TelerikPdfViewer Events](slug://components/pdfviewer/events) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.