mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Move the maxImageSize
option from the global PDFJS
object and into getDocument
instead
This commit is contained in:
parent
b0956a5d91
commit
b674409397
6 changed files with 21 additions and 17 deletions
|
@ -150,6 +150,9 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
|
|||
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
|
||||
* PDF data cannot be successfully parsed, instead of attempting to recover
|
||||
* whatever possible of the data. The default value is `false`.
|
||||
* @property {number} maxImageSize - (optional) The maximum allowed image size
|
||||
* in total pixels, i.e. width * height. Images above this value will not be
|
||||
* rendered. Use -1 for no limit, which is also the default value.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -195,7 +198,7 @@ function getDocument(src) {
|
|||
source = src;
|
||||
}
|
||||
|
||||
var params = {};
|
||||
let params = Object.create(null);
|
||||
var rangeTransport = null;
|
||||
let worker = null;
|
||||
var CMapReaderFactory = DOMCMapReaderFactory;
|
||||
|
@ -237,11 +240,14 @@ function getDocument(src) {
|
|||
params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;
|
||||
params.ignoreErrors = params.stopAtErrors !== true;
|
||||
|
||||
const nativeImageDecoderValues = Object.values(NativeImageDecoding);
|
||||
const NativeImageDecoderValues = Object.values(NativeImageDecoding);
|
||||
if (params.nativeImageDecoderSupport === undefined ||
|
||||
!nativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {
|
||||
!NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {
|
||||
params.nativeImageDecoderSupport = NativeImageDecoding.DECODE;
|
||||
}
|
||||
if (!Number.isInteger(params.maxImageSize)) {
|
||||
params.maxImageSize = -1;
|
||||
}
|
||||
|
||||
// Set the main-thread verbosity level.
|
||||
setVerbosityLevel(params.verbosity);
|
||||
|
@ -327,7 +333,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
|||
rangeChunkSize: source.rangeChunkSize,
|
||||
length: source.length,
|
||||
},
|
||||
maxImageSize: getDefaultSetting('maxImageSize'),
|
||||
maxImageSize: source.maxImageSize,
|
||||
disableFontFace: getDefaultSetting('disableFontFace'),
|
||||
disableCreateObjectURL: getDefaultSetting('disableCreateObjectURL'),
|
||||
postMessageTransfers: worker.postMessageTransfers,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue