Extensions/Assessment/renderPDF

Extensions add specific functionality to Items API. They rely on modules within LT being available.

--

Renders any PDF uploaded as a resource to any item in the activity. Uses the pdf.js webviewer that has a toolbar to zoom, view thumbnails, and download etc.

By enabling this extension, all PDFs will be rendered in the viewer.

Methods

run()

Sets up an item load listener to the current item for any resources that have been uploaded during authoring. We parse the DOM for resources because they aren't available in the item or question JSON.

If the resource is a PDF, render using the pdf.js viewer.

Since
2.2.0
Example
import { LT } from '@caspingus/lt/src/assessment/index';

LT.init(itemsApp); // Set up LT with the Items API application instance variable
LT.extensions.renderPDF.run();