WT PDF.js

Downloads 3449 Hits 2945 CTR 117% Plg Free

A general-purpose, web standards-based platform for parsing and rendering PDFs.

WT PDF.js

Description

WT PDF.js is a system plugin for Joomla 5 and later that registers PDF.js in WebAssetManager. Use it in PDF-enabled modules, components and template overrides.

  • Local PDF.js 6.4.299 libraries for newer and older browsers.
  • A CDN latest asset that automatically selects a worker with the matching version.
  • Two complete web viewers, opened through a link or embedded in an iframe.
  • User JSON profiles for theme, zoom, language, sidebar and PDF loading settings.
  • Configuration files are stored separately and survive plugin updates.

The plugin supplies the library and viewers; your extension integrates them and displays PDFs. The installer requires PHP 8.1 or later; your Joomla version requirements must also be met.

How to use?

Plugin for Joomla developers. It allows you to use PDF.js anywhere in Joomla 5+: in modules, components, plugins.

Activate the appropriate asset in your code:

<?php
use Joomla\CMS\Factory;

$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('wt-pdf-js');          // Local: newer browsers
// $wa->useScript('wt-pdf-js-legacy'); // Local: older browsers
// $wa->useScript('wt-pdf-js-latest'); // CDN latest; choose ONE build

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 Apache module mod_mime is installed and enabled 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, 5.3.3, 6.1.4

What's new

Change

PDF.js 6.4.299

Updated local PDF.js libraries, workers and resources for newer and older browsers to version 6.4.299.
Addition

Two complete web viewers

The package now includes complete viewers for newer and older browsers, opened through links or embedded in iframes.
Addition

User JSON profiles

Added default.json, named profile selection through config, and config=none. Profiles are stored separately and survive updates. Instructions are available in plugin parameters and project documentation.

Related extensions

WebTolk Joomla Extensions

113 Extensions
12 Categories
585 Versions released
906096 Downloads