Using the PDFViewer with the latest version of PDF.js (3.9.179) throws js exceptions. Version 3.4.120 is the last one, with which no js exception is thrown.
Dojo example: https://dojo.telerik.com/IHedIhur/3
The file is loaded, however, js exceptions are thrown:
The --scale-factor
CSS-variable must be set, to the same value as viewport.scale
, either on the container
-element itself or higher up in the DOM. text_layer.js:480:14
No js exceptions when using PDF.js versions newer than v3.4.120.
<div id="pdfViewer">
</div>
<script type="text/javascript">
$("#pdfViewer").kendoPDFViewer({
pdfjsProcessing: {
file: ""
}
});
function loadFile() {
$("#pdfViewer").data("kendoPDFViewer").fromFile("@Url.Action("GetPDF", "Home")");
}
</script>
public ActionResult GetPDF()
{
var name = "sample.pdf";
string path = Server.MapPath("/Content/pdf/sample.pdf");
//generate a random boolean:
Random rng = new Random();
bool randomBool = rng.Next(0, 2) > 0;
if (randomBool)
{
byte[] fileBytes = System.IO.File.ReadAllBytes(path);
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, name);
}
else
{
return new HttpNotFoundResult("File not found.");
}
}
In the case where the request returns HttpNotFoundResult, a number of js errors are thrown:
util.js:417 Uncaught (in promise)
The user loses the ability to load a file, because subsequent attempts to load a file by clicking the button result in another js exception:
api.js:1114 Uncaught TypeError: Cannot read properties of null (reading 'sendWithStream')
The component should show a message that a file is not found, without throwing js exceptions and should not become unusable after a failed attempt to load a file.
Currently, default zoom can be set through JavaScript in the Render event handler of the PDFViewer:
Attach the handler:
.Events(e => e.Render("onRender"))
The event handler:
<script>
var firstRender = true;
function onRender(e) {
if (firstRender) {
var combobox = e.sender.toolbar.element.find("[data-command=ZoomCommand][data-role=combobox]").data("kendoComboBox");
combobox.value("fitToWidth");
combobox.trigger("change");
firstRender = false;
}
}
</script>
A better solution would be a dedicated configuration option that allows setting the default zoom when declaring the PDFViewer.
Currently, the search in PDF Viewer is performed on every keypress in the search input field.
The search performance of the widget could be improved if there is a possibility to perform a search on pressing "Enter". Another valuable enhancement could be a configuration that allows the search to be performed after entering a certain number of symbols.
Hi,
i tested the updated pdfviewer of version 2019.3.1023, but it did not work as expected.
I have some questions about usage und customizing
https://dojo.telerik.com/EmErekOB
Regards
Christian
Bug report
Open a pdf file with links in PDF Viewer. Links are not clickable.
Reproduction of the problem
Open the demo for the PDF Viewer
Open a file, containing links
Click on a link
Current behavior
Clicking on a link does not redirect to the page
Expected/desired behavior
Clicking on a link should redirect to the link.
Environment
Kendo UI version: 2019.3.1023
Browser: [all]