Commit 9a19ed5a authored by Aaron Wells's avatar Aaron Wells Committed by Robert Lyon
Browse files

Make pdf.js use absolute file urls, and get PDF URl from a JS variable

Bug 1316407: By default, this version of pdf.js wants to take the PDF
URL from a URL query parameter. It also wants to refer to several of its
JS libraries by relative paths, which sometimes conk out in Mahara.

Change-Id: I1be894beb825bae4070e6e43c5900d43313ef583
parent 329faef5
......@@ -23,3 +23,5 @@ Changes:
* viewer.css additions to support viewing by non-JS users
* viewer.css tweak to get the bottom of the display to show
* viewer.css tweak to avoid horizontal scrollbar on default 3-column page layout
* Change viewer.js to get the PDF file from a JS variable instead of a URL query parameter
* Change viewer.js to use absolute URLs to JS libraries
......@@ -54,9 +54,9 @@ var FindStates = {
PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '../build/pdf.worker.js';
PDFJS.cMapUrl = '../web/cmaps/';
PDFJS.imageResourcesPath = wwwroot + 'artefact/file/blocktype/pdf/js/pdfjs/images/';
PDFJS.workerSrc = wwwroot + 'artefact/file/blocktype/pdf/js/pdfjs/build/pdf.worker.js';
PDFJS.cMapUrl = wwwroot + 'artefact/file/blocktype/pdf/js/pdfjs/web/cmaps/';
PDFJS.cMapPacked = true;
var mozL10n = document.mozL10n || document.webL10n;
......@@ -5063,6 +5063,7 @@ function webViewerLoad(evt) {
function webViewerInitialized() {
var params = PDFView.parseQueryString(;
var file = 'file' in params ? params.file : DEFAULT_URL;
file = fileurl;
var fileInput = document.createElement('input'); = 'fileInput';
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment