Unplanned
Last Updated: 05 Apr 2024 08:52 by ADMIN
Mugurel
Created on: 03 Aug 2023 12:44
Category: PDFViewer
Type: Bug Report
5
JavaScript exceptions when using the PDFViewer with the latest PDF.js version

Bug report

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.

Reproduction of the problem

Dojo example: https://dojo.telerik.com/IHedIhur/3

  1. Open the devtools consolve and run the example.

Current behavior

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

Expected/desired behavior

No js exceptions when using PDF.js versions newer than v3.4.120.

Environment

  • Kendo UI version: 2023.2.718
  • jQuery version: x.y
  • Browser: [all]
1 comment
Brodie
Posted on: 10 Nov 2023 15:39

I was able to find a workaround for this by injecting a function on top of the PDF.js renderTextLayer function to set the --scale-factor. It has not been fully tested yet, but it does get rid of the console.errors and the PDF renders fine.

Here is a dojo with the workaround: https://dojo.telerik.com/@broderickhyman/AGuXAMaP/3