PDF-documents not loading inside iframe in Chrome and Edge

24 views Asked by At

I want to display a given PDF-file inside the same browser window. For this I fetch the base64-encoded file-data from the server and set the src-content.

// mimeType usually is 'application/pdf'
iframeContent = `data:${fileBase64Data.mimeType};base64,${fileBase64Data.base64DataString}`;
<iframe src="iFrameContent" height="100%" width="100%"></iframe>

Whenever I want to display a document in Firefox it displays the content just fine. In Chrome or Edge it occasionally happens that the iframe doesn't get rendered at all. It just displays a blank space where the rendered document should be displayed.

Also I am using Kendo UI for jQuery with the MVVM-pattern as a framework. src instead looks like this: src="#= data.iFrameContent #". But I am not completely sure if it has anything to do with my issue.

I've tested with a bunch of different files in pdf-format and the only pattern I could see was that the iframe stops rendering if the size of the file exceeds roughly 6MB. I tried to display it via <embed> as well but it led to the same issue. So apparently it's not the iframe itself but perhaps a limitation inside the chromium-engine itself?

0

There are 0 answers