Choose a PDF.js build for a Joomla page
This works in a frontend module layout, component view or template override. Keep one library activation per window: multiple builds may replace the global object and worker settings. Each iframe creates its own window, so its viewer works independently.
Use globalThis.pdfjsLib after module execution. Initializers set GlobalWorkerOptions.workerSrc. A worker script tag does not enable background processing; PDF.js creates its worker from that configured URL.
PHP example
<?php
use Joomla\CMS\Factory;
$document = Factory::getApplication()->getDocument();
$wa = $document->getWebAssetManager();
// Choose ONE build for this page.
$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, newer browsers