WT PDF.js
- Categories: Joomla plugins, Web Assets
- Version: 4.10.38
- Date:
A general-purpose, web standards-based platform for parsing and rendering PDFs.

Description
Plugin register a PDF.js bundle in Joomla Web Assets Manager. Then you can use it in your extensions.
How to use?
Plugin for Joomla developers. It allows you to use PDF.js anywhere in Joomla 4+: in modules, components, plugins.
To do this in your code, use
<?php
use Joomla\CMS\Factory;
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('wt-pdf-js'); // Local file
$wa->useScript('wt-pdf-js-remote'); // Use from CDN
Configuring MIME types on the server for *.MJS-files
Servers often do not have MIME types configured for files with *.mjs
extensions. Therefore, the browser may not understand that this is actually javascript code and you may see an error in the browser console pdf.mjs:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.
To solve this problem, you either need to ask the hosting company's technical support to configure MIME types for mjs
files. Or do it yourself:
1. Make sure that the PHP module mod_mime
is installed and enabled in the list of PHP extensions on the server.
2. Add the following code to the end of your .htaccess
:
<IfModule mod_mime.c>
AddType text/javascript mjs
</IfModule>
Joomla
- Extension type:
- Plugin
- Folder:
- System
- Joomla version:
- 5.2.3