Hello
This component is working well with small pdf but when trying with bigger file nothing is rendering
Do you have encountered this behaviour ?
Kind regards
luc
Hello Luc,
I faced this issue a few weeks ago and I was able to fix it.
Steps:
- Create the OnReady event in the BinaryPDF block and call OnParametersChanged inside it.
- Inside OnParametersChanged change the latest Javascript call to this:
// Render big files with blob
const binStr = atob( $parameters.Base64 );
const len = binStr.length;
const arr = new Uint8Array(len);
for (let i = 0; i < len; i++) {
arr[ i ] = binStr.charCodeAt( i );
}
const blob = new Blob( [ arr ], { type: 'application/pdf' } );
const url = URL.createObjectURL( blob );
document.getElementById($parameters.iframId).setAttribute("src", URL);
// OLD CODE
//document.getElementById($parameters.iframId).setAttribute("src", "data:application/pdf;base64,"+$parameters.Base64);
With this code the Block can render big PDF files.