Add verbosity as an api setting.
This commit is contained in:
parent
f2b717c637
commit
53549411b4
@ -230,6 +230,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
||||
PDFJS.maxImageSize = data.maxImageSize === undefined ?
|
||||
-1 : data.maxImageSize;
|
||||
PDFJS.disableFontFace = data.disableFontFace;
|
||||
PDFJS.verbosity = data.verbosity;
|
||||
|
||||
getPdfManager(data).then(function pdfManagerReady() {
|
||||
loadDocument(false).then(onSuccess, function loadFailure(ex) {
|
||||
|
@ -93,6 +93,18 @@ PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug;
|
||||
*/
|
||||
PDFJS.postMessageTransfers = PDFJS.postMessageTransfers === undefined ?
|
||||
true : PDFJS.postMessageTransfers;
|
||||
|
||||
/**
|
||||
* Controls the logging level.
|
||||
* The constants from PDFJS.VERBOSITY_LEVELS should be used:
|
||||
* - errors
|
||||
* - warnings [default]
|
||||
* - infos
|
||||
* @var {Number}
|
||||
*/
|
||||
PDFJS.verbosity = PDFJS.verbosity === undefined ?
|
||||
PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity;
|
||||
|
||||
/**
|
||||
* This is the main entry point for loading a PDF and interacting with it.
|
||||
* NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)
|
||||
@ -864,7 +876,8 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
||||
source: source,
|
||||
disableRange: PDFJS.disableRange,
|
||||
maxImageSize: PDFJS.maxImageSize,
|
||||
disableFontFace: PDFJS.disableFontFace
|
||||
disableFontFace: PDFJS.disableFontFace,
|
||||
verbosity: PDFJS.verbosity
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -22,9 +22,6 @@ var globalScope = (typeof window === 'undefined') ? this : window;
|
||||
|
||||
var isWorker = (typeof window == 'undefined');
|
||||
|
||||
var ERRORS = 0, WARNINGS = 1, INFOS = 5;
|
||||
var verbosity = WARNINGS;
|
||||
|
||||
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
||||
|
||||
var TextRenderingMode = {
|
||||
@ -49,6 +46,12 @@ if (!globalScope.PDFJS) {
|
||||
|
||||
globalScope.PDFJS.pdfBug = false;
|
||||
|
||||
PDFJS.VERBOSITY_LEVELS = {
|
||||
errors: 0,
|
||||
warnings: 1,
|
||||
infos: 5
|
||||
};
|
||||
|
||||
// All the possible operations for an operator list.
|
||||
var OPS = PDFJS.OPS = {
|
||||
// Intentionally start from 1 so it is easy to spot bad operators that will be
|
||||
@ -157,7 +160,7 @@ var log = (function() {
|
||||
// for things that are helpful to devs, such as warning that Workers were
|
||||
// disabled, which is important to devs but not end users.
|
||||
function info(msg) {
|
||||
if (verbosity >= INFOS) {
|
||||
if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) {
|
||||
log('Info: ' + msg);
|
||||
PDFJS.LogManager.notify('info', msg);
|
||||
}
|
||||
@ -165,7 +168,7 @@ function info(msg) {
|
||||
|
||||
// Non-fatal warnings that should trigger the fallback UI.
|
||||
function warn(msg) {
|
||||
if (verbosity >= WARNINGS) {
|
||||
if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.warnings) {
|
||||
log('Warning: ' + msg);
|
||||
PDFJS.LogManager.notify('warn', msg);
|
||||
}
|
||||
|
@ -1603,6 +1603,10 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
USE_ONLY_CSS_ZOOM = (hashParams['useOnlyCssZoom'] === 'true');
|
||||
}
|
||||
|
||||
if ('verbosity' in hashParams) {
|
||||
PDFJS.verbosity = hashParams['verbosity'] | 0;
|
||||
}
|
||||
|
||||
//#if !(FIREFOX || MOZCENTRAL)
|
||||
var locale = navigator.language;
|
||||
if ('locale' in hashParams)
|
||||
|
Loading…
Reference in New Issue
Block a user