The PdfViewer GetFileAsync() method works in version 11.3.0, but only if the PDF Viewer loads a file by default. If the component renders blank and the user opens a file first, then the method still doesn't work and returns null.
Test page: https://blazorrepl.telerik.com/cpvuGQby16J4JlsE42
<p>Load a PDF file from your computer in both PDF Viewers and click the buttons.</p>
<strong>@TestResult</strong>
<br /><br />
<TelerikButton OnClick="@OnLoadButtonClick1" ThemeColor="@ThemeConstants.Button.ThemeColor.Primary">Get Current PDF 1</TelerikButton>
<TelerikPdfViewer @ref="@PdfViewerRef1"
Data="@PdfViewerData1"
AnnotationMode="@PdfViewerAnnotationMode.EnableForms"
Height="400px">
</TelerikPdfViewer>
<TelerikButton OnClick="@OnLoadButtonClick2" ThemeColor="@ThemeConstants.Button.ThemeColor.Primary">Get Current PDF 2</TelerikButton>
<TelerikPdfViewer @ref="@PdfViewerRef2"
Data="@PdfViewerData2"
AnnotationMode="@PdfViewerAnnotationMode.EnableForms"
Height="400px">
</TelerikPdfViewer>
@code {
#nullable enable
private TelerikPdfViewer? PdfViewerRef1 { get; set; }
private TelerikPdfViewer? PdfViewerRef2 { get; set; }
private byte[]? PdfViewerData1 { get; set; }
private byte[]? PdfViewerData2 { get; set; }
private string TestResult { get; set; } = string.Empty;
private async Task OnLoadButtonClick1()
{
var pdfSource = await PdfViewerRef1!.GetFileAsync();
TestResult = $"First PDF Viewer GetFileAsync() returned {pdfSource} at {DateTime.Now.ToString("HH:mm:ss")}";
}
private async Task OnLoadButtonClick2()
{
var pdfSource = await PdfViewerRef2!.GetFileAsync();
TestResult = $"Second PDF Viewer GetFileAsync() returned {(pdfSource != null ? pdfSource.ToString() : "null")} at {DateTime.Now.ToString("HH:mm:ss")}";
}
protected override void OnInitialized()
{
PdfViewerData1 = Convert.FromBase64String(PdfBase64);
}
private const string PdfBase64 = "JVBERi0xLjEKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqCjIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDEvTWVkaWFCb3ggWy0zMCAtNjQgMjcwIDgwXSA+PmVuZG9iagozIDAgb2JqPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9SZXNvdXJjZXM8PC9Gb250PDwvRjE8PC9UeXBlL0ZvbnQvU3VidHlwZS9UeXBlMS9CYXNlRm9udC9BcmlhbD4+ID4+ID4+L0NvbnRlbnRzIDQgMCBSPj5lbmRvYmoKNCAwIG9iajw8L0xlbmd0aCA1OT4+CnN0cmVhbQpCVAovRjEgMTggVGYKMCAwIFRkCihQREYgRmlsZSAuLi4pIFRqCkVUCmVuZHN0cmVhbQplbmRvYmoKeHJlZgowIDUKMDAwMDAwMDAwMCA2NTUzNSBmCjAwMDAwMDAwMjEgMDAwMDAgbgowMDAwMDAwMDg2IDAwMDAwIG4KMDAwMDAwMDE5NSAwMDAwMCBuCjAwMDAwMDA0OTAgMDAwMDAgbgp0cmFpbGVyIDw8ICAvUm9vdCAxIDAgUiAvU2l6ZSA1ID4+CnN0YXJ0eHJlZgo2MDkKJSVFT0Y=";
}
When a user invokes a Search tool, their intention is to directly write a text to search, therefore the edit for the search text should be focused immediately. In the current implementation, users have to manually focus the edit all the time, which is really inconvenient.
Related to PDF Viewer does not display editable Acro fields, which was fixed in version 8.0, but the problem with readonly Acro fields persisted.
This is a regression in version 7.0.0. Version 6.2.0 displays all the acro field values as expected.
Rebinding the PDF Viewer multiple times leads to an ever increasing memory usage, which can ultimately cause a browser crash.
The issue started with Telerik UI for Blazor version 8.0.0 and does not occur in 7.1.0.
Test Page: https://blazorrepl.telerik.com/QTayOxvQ090qYPsb50
Trying to upload a large file from a mobile device breaks the component.
Step to reproduce:
The issue can be reproduced only in version 8.0.0
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.
=====
TELERIK EDIT: Here is a possible workaround - replace the built-in PDF Viewer LoaderContainer with another one with a different animation Type.
<div class="pdfviewer-wrapper">
<TelerikPdfViewer Height="600px" />
@* With a Loading... label *@
<TelerikLoaderContainer Class="pdf-loader-container"
OverlayThemeColor="@ThemeConstants.Loader.ThemeColor.Light"
Size="@ThemeConstants.Loader.Size.Large"
Visible="true" />
@* Without a Loading... label *@
@*<TelerikLoaderContainer Class="pdf-loader-container"
OverlayThemeColor="@ThemeConstants.Loader.ThemeColor.Light"
Visible="true">
<Template>
<TelerikLoader Size="@ThemeConstants.Loader.Size.Large"
Type="@LoaderType.Pulsing" />
</Template>
</TelerikLoaderContainer>*@
</div>
<style>
.pdfviewer-wrapper {
position: relative;
}
.pdf-loader-container,
.k-pdf-viewer .k-loader-container {
visibility: hidden;
}
.k-pdf-viewer:has(.k-loader-container:not([style*="none"])) + .pdf-loader-container {
visibility: visible;
}
</style>
@code {
private byte[]? PdfViewerData { get; set; }
}
I want to detect when a user has added or removed an annotation in the 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;
}
}
We still have some problems with printed pdf quality after the updates in 6.0.0. When pdf is printed using Telerik PDF viewer it seems it gets processed/rasterized and loses quality.
Acro field values don't show in the PDF VIewer, although they display in the print preview dialog.
This is a regression in version 7.0.0. Version 6.2.0 displays the acro field values as expected.
===
TELERIK edit: This public item originally concerned to all Acro fields. We fixed the problem for editable Acro fields, while the fix for readonly ones can be tracked at PDF Viewer does not display readonly Acro fields