Commit 501ec778 authored by Yusei Tahara's avatar Yusei Tahara

erp5_dms: PDF reader is very slow to open a large base64 encoded PDF embedded in…

… HTML or it fails to open such a large PDF. Thus, now PDF reader opens a PDF using URL. It is faster and stable.

/reviewed-on nexedi/erp5!468
parent 1d493de7
......@@ -50,6 +50,10 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>data_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
......@@ -111,7 +115,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.getData().encode("base64")</string> </value>
<value> <string>python: context.absolute_url()+\'/getData\'</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -21,15 +21,7 @@
window.document.head.removeChild(el);
});
this.props.key = options.key;
var raw = window.atob(options.value);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for (var i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
webViewerLoad(array);
webViewerLoad(options.value);
// hide few buttons for now
this.props.element.querySelector('#viewBookmark').hidden = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment