渲染异步时 Jsreport Malformed URI 错误
Jsreport Malformed URI error when rendering Async
由于我在请求中发送大量数据,因此我必须使用 renderAsync 才能使用 POST。当流回来的时候,我用下面的JS代码打开它
jsreport.renderAsync(request).then(function(arrayBuffer) {
window.open("data:application/pdf;base64," + arrayBuffer
)};);
但是随后出现错误。有其他方法吗?
这似乎有效
<script>
jsreport.renderAsync(request).then(function(response) {
var uInt8Array = new Uint8Array(response);
var i = uInt8Array.length;
var binaryString = new Array(i);
while (i--)
{
binaryString[i] = String.fromCharCode(uInt8Array[i]);
}
var data = binaryString.join('');
var base64 = window.btoa(data);
window.open("data:application/pdf;base64, " + base64);
})
</script>
由于我在请求中发送大量数据,因此我必须使用 renderAsync 才能使用 POST。当流回来的时候,我用下面的JS代码打开它
jsreport.renderAsync(request).then(function(arrayBuffer) {
window.open("data:application/pdf;base64," + arrayBuffer
)};);
但是随后出现错误。有其他方法吗?
这似乎有效
<script>
jsreport.renderAsync(request).then(function(response) {
var uInt8Array = new Uint8Array(response);
var i = uInt8Array.length;
var binaryString = new Array(i);
while (i--)
{
binaryString[i] = String.fromCharCode(uInt8Array[i]);
}
var data = binaryString.join('');
var base64 = window.btoa(data);
window.open("data:application/pdf;base64, " + base64);
})
</script>