Open the PDF Viewer component online demo and click the download button:
Expected - the PDF must be downloaded.
Current - the file is not downloaded.
After clicking the Print button, the pages are ordered incorrectly. Can be seen in the preview window.
Steps to reproduce:
1. Open https://demos.telerik.com/blazor-ui/pdfviewer/overview
2. Click the Print button
We're currently working on requiring a Google CASA Security Assessment, as part of this they scanned our site.
However, the scan found an eval() function in the telerik-blazor.js file:
if(_util.isNodeJS){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}
Is it possible to remove eval() from telerik-blazor.js?
When the user scrolls the PDF Viewer down and then opens another PDF file, the new document should display on the first page. Currently, the new file displays scrolled to the page from the previous file and the user must scroll to the top manually.
===
A possible workaround is to scroll the PDF file with JavaScript in the PDF Viewer OnOpen event:
@inject IJSRuntime js
<TelerikPdfViewer Data="@PdfSource"
Height="600px"
OnOpen="@OnPdfViewerOpen"
Class="@PdfViewerClass">
</TelerikPdfViewer>
<script suppress-error="BL9992">
function scrollPdfToTop(selector) {
var pdfCanvas = document.querySelector(selector);
if (pdfCanvas) {
pdfCanvas.scrollTop = 0;
}
}
</script>
@code {
private byte[]? PdfSource { get; set; }
private string PdfViewerClass { get; set; } = "scrollable-pdf-viewer";
private async Task OnPdfViewerOpen()
{
await js.InvokeVoidAsync("scrollPdfToTop", $".{PdfViewerClass} .k-pdf-viewer-canvas");
}
}
Hallo,
i want to Render PDF Files with the PDF Viewer Component.
The Data of the PDF is already fetched from the API when the PDF-Viewer starts Rendering the Loading animation appears and freezes.
After a few Seconds the PDF will be Rendered.
The size of the PDF File is about 5MB.
If the PdfViewer is initialized with a default document, the display performance of this document will be a lot worse, compared to PDF documents that are loaded programmatically after the component is already on the web page.
When you search for a term, the document is not scrolled. Also when the user inserts a search term and clicks Enter the document is scrolled to the second match instead of the first one.
The loading animation is visible only when a user opens a file from the Toolbar of the component. When programmatically opening a file, the loader is not shown.
Set the PdfViewer document (data) value to null. As a result, an endless loader will appear.
===
ADMIN EDIT
===
A possible workaround for the time being is to re-initialize the component after clearing the file: https://blazorrepl.telerik.com/cHYwQola24zzBOAd02.