Declined
Last Updated: 28 May 2025 17:41 by ADMIN
Nathan
Created on: 16 May 2025 02:05
Category: UI for Blazor
Type: Bug Report
0
Conflict with PDF.js being included globally in telerik-blazor.js
When trying to use a separate blazor component that references pdf.js, I received the following error ```The API version "4.10.38" does not match the Worker version "4.6.82".```  I was able to narrow it down to the <script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js"></script> causing the conflict in versions.  Could this be updated to not expose the pdf.js version that Telerik uses globally, but instead isolate it?
4 comments
ADMIN
Hristian Stefanov
Posted on: 28 May 2025 17:41

Hi Nathan,

Thank you for sharing the use case and the reasoning behind your current configuration — your feedback is appreciated. At this point, there are no changes planned regarding support for encapsulation.

If that changes in the future, or if the following item gets scheduled: https://feedback.telerik.com/blazor/1684062-url-parameter-to-allow-loading-cloud-hosted-pdfs, you’ll be notified.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Nathan
Posted on: 22 May 2025 14:54
I just pulled the latest blazor ui source code and I'm not seeing the pdf.js dependency directly.  After looking at the javascript/src/pdf-viewer.ts, it looks like the PdfViewer dependency is coming from @progress/kendo-pdfviewer-common.  In the package.json that package using version >=0.5.0-develop.6
Nathan
Posted on: 22 May 2025 14:47

Hi Hristian,

Thanks for your response.  The most important feature for using an outside component (or creating my own pdf.js wrapper component) is the fact that the Telerik Blazor PDF viewer component does not support loading pdfs via their url (cloud hosted pdfs) purely on the client side.  I need to be able to serve a large dynamic library of pdfs to my client without consuming server memory.  Using PDF.js to serve PDFs directly to the client solves that problem.  Right now, I'm avoiding the PDF.js version conflict issue by just using an iframe with the PDF url and allowing the clients' browser's native ability to render PDFs in the browser (mostly using PDF.js) to handle it.  This works well, but doesn't give the control that I would like over the pdf viewer.

I had originally requested the ability to render cloud hosted PDFs in this feature request here: https://feedback.telerik.com/blazor/1684062-url-parameter-to-allow-loading-cloud-hosted-pdfs

I didn't realize I could build Telerik UI from source.  That might be a viable option.  Thanks

 

ADMIN
Hristian Stefanov
Posted on: 22 May 2025 14:36

Hi Nathan,

PDF.js works in such a way, that it does not support encapsulation. Two separate third-party products cannot use two different PDF.js versions.

As a result, you have a few options:

  • Match the PDF.js API versions of both products, if this is possible.
  • Upgrade our PDF.js version to match yours, OR remove PDF.js from our JavaScript file. This will require you to download our source code and rebuild our JavaScript file. The PDF.js dependency and version is set in /javascript/package.json. You will need to do this every time you upgrade Telerik UI for Blazor, and our version doesn't match yours.
  • Change the app infrastructure, so that the two PDF.js dependencies are not used at the same time. This may or may not be feasible. For example, the app page that is using the other PDF.js dependency should not load telerik-blazor.js, it should not use our components, and its layout file should not include <TelerikRootComponent>.

On a side note, which is the most important feature of the other component that references pdf.js, which makes you prefer it over ours?

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.