parent
ee5d98d5d0
commit
75bfb547ba
@ -83,10 +83,20 @@ def _generate_pdfjs_script(filename):
|
|||||||
|
|
||||||
return jinja.js_environment.from_string("""
|
return jinja.js_environment.from_string("""
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
{% if disable_create_object_url %}
|
if (typeof window.PDFJS !== 'undefined') {
|
||||||
PDFJS.disableCreateObjectURL = true;
|
// v1.x
|
||||||
{% endif %}
|
{% if disable_create_object_url %}
|
||||||
PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;
|
window.PDFJS.disableCreateObjectURL = true;
|
||||||
|
{% endif %}
|
||||||
|
window.PDFJS.verbosity = window.PDFJS.VERBOSITY_LEVELS.info;
|
||||||
|
} else {
|
||||||
|
// v2.x
|
||||||
|
const options = window.PDFViewerApplicationOptions;
|
||||||
|
{% if disable_create_object_url %}
|
||||||
|
options.set('disableCreateObjectURL', true);
|
||||||
|
{% endif %}
|
||||||
|
options.set('verbosity', pdfjsLib.VerbosityLevel.INFOS);
|
||||||
|
}
|
||||||
|
|
||||||
const viewer = window.PDFView || window.PDFViewerApplication;
|
const viewer = window.PDFView || window.PDFViewerApplication;
|
||||||
viewer.open("{{ url }}");
|
viewer.open("{{ url }}");
|
||||||
|
Loading…
Reference in New Issue
Block a user