使用 pdf.js 我最多只能读取 2MB 的 pdf,不能超过 2MB,为什么?
Using pdf.js I'm able to read only pdf's upto 2MB and not more than that, why?
读取某些页面后出现错误
"pdf.js:25744 Uncaught DOMException: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': Data cannot be cloned, out of memory."
只有当我使用超过 2 MB 的文件时才会出现这种情况。
如何更改 pdf.js 文件中的最大允许文件?
MessageHandler.prototype = {
on: function messageHandlerOn(actionName, handler, scope) {
var ah = this.actionHandler;
if (ah[actionName]) {
throw 'There is already an actionName called "' + actionName + '"';
}
ah[actionName] = [handler, scope];
},
send: function messageHandlerSend(actionName, data) {
this.comObj.postMessage({ //console is showing error in this line
action: actionName,
data: data
});
}
};
尝试在你的php.ini中增加upload_max_filesize和post_max_size(通常你会发现2M)
增加post_max_size
和upload_max_filesize
。您可以在 php.ini
中设置 2 个不同的位置,因为 upload_max_filesize
的默认 PHP 值为 2 MB,post_max_size
.
的默认值为 8 MB
; Maximum allowed size for uploaded files.
upload_max_filesize = 20M
; Must be greater than or equal to upload_max_filesize
post_max_size = 20M
此更改需要重新启动服务器
读取某些页面后出现错误
"pdf.js:25744 Uncaught DOMException: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': Data cannot be cloned, out of memory."
只有当我使用超过 2 MB 的文件时才会出现这种情况。
如何更改 pdf.js 文件中的最大允许文件?
MessageHandler.prototype = {
on: function messageHandlerOn(actionName, handler, scope) {
var ah = this.actionHandler;
if (ah[actionName]) {
throw 'There is already an actionName called "' + actionName + '"';
}
ah[actionName] = [handler, scope];
},
send: function messageHandlerSend(actionName, data) {
this.comObj.postMessage({ //console is showing error in this line
action: actionName,
data: data
});
}
};
尝试在你的php.ini中增加upload_max_filesize和post_max_size(通常你会发现2M)
增加post_max_size
和upload_max_filesize
。您可以在 php.ini
中设置 2 个不同的位置,因为 upload_max_filesize
的默认 PHP 值为 2 MB,post_max_size
.
; Maximum allowed size for uploaded files.
upload_max_filesize = 20M
; Must be greater than or equal to upload_max_filesize
post_max_size = 20M
此更改需要重新启动服务器