簡體   English   中英

使用pdf.js我只能讀取高達2MB的pdf而不是更多,為什么?

[英]Using pdf.js I'm able to read only pdf's upto 2MB and not more than that, why?

一些頁面被讀取后我收到錯誤

“pdf.js:25744未捕獲DOMException:無法在'DedicatedWorkerGlobalScope'上執行'postMessage':無法克隆數據,內存不足。”

僅當我使用大小超過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_sizeupload_max_filesize 有2個不同的地方,你可以將其設置在php.ini ,因為PHP的默認值是2 MB的upload_max_filesize和8 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

此更改需要重新啟動服務器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM