Commit b4d52458 authored by Aaron Wells's avatar Aaron Wells Committed by Son Nguyen
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: If4a5ea386f1ccb291a86f940b7d54f4f4e4cb4a3
parent a6820f84
......@@ -24,3 +24,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
......@@ -38,9 +38,9 @@ var SCALE_SELECT_PADDING = 22;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '../build/pdf.worker.min.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.min.js';
PDFJS.cMapUrl = wwwroot + 'artefact/file/blocktype/pdf/js/pdfjs/web/cmaps/';
PDFJS.cMapPacked = true;
var mozL10n = document.mozL10n || document.webL10n;
......@@ -6220,6 +6220,7 @@ function webViewerInitialized() {
var queryString =;
var params = PDFViewerApplication.parseQueryString(queryString);
var file = 'file' in params ? params.file : DEFAULT_URL;
file = fileurl;
var fileInput = document.createElement('input'); = 'fileInput';
Supports Markdown
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