title: Creating iframe with dataURI fails for large files, any workaround?
body: <pre><code>    function openNewWindow(strPreviewId) {
          let newWindowViewer = window.open("");
          var index = mapPreviewIdWithFile[strPreviewId].indexOf('base64,');
          var attachBody = mapPreviewIdWithFile[strPreviewId].substring(index + 7);
          var attachmentMimeType = mapPreviewIdWithFile[strPreviewId].substring(0, index + 7);
          newWindowViewer.document.write("&lt;iframe width='100%' height='100%' src='" + attachmentMimeType + " " + encodeURI(attachBody) + "'&gt;&lt;/iframe&gt;");
  
      }
  </code></pre>
  
  <p>finally the iframe gets created like below:</p>
  
  <p><code>&lt;iframe width="100%" height="100%" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAA9AAAALaCAYAAADZQrs6AAAAAXNSR0IArs4..."&gt;&lt;/iframe&gt;</code></p>
  
  <p>For files like more than 10MB the attachBody changes to 26 MB, thus it fails to render in the new window. Is there any other library or workaorund which handles large files.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I was trying with canvas, but with canvas the full inage is bnot being shown, only a part is being shown.</p>
  
  <pre><code>        if (attachmentMimeType.indexOf('bmp') &gt; -1 || attachmentMimeType.indexOf('gif') &gt; -1 || attachmentMimeType.indexOf('jpeg') &gt; -1 ||
              attachmentMimeType.indexOf('jpg') &gt; -1 || attachmentMimeType.indexOf('pdf') &gt; -1 || attachmentMimeType.indexOf('png') &gt; -1) {
              newWindowViewer.document.write('&lt;canvas id="c"&gt;&lt;/canvas&gt;');
              var canvas = newWindowViewer.document.getElementById("c");
              var ctx = canvas.getContext("2d");
  
              var image = new Image();
              image.onload = function() {
                  ctx.drawImage(image, 0, 0, image.height, image.width);
              };
              image.src = attachmentMimeType + " " + encodeURI(attachBody);
          } else {
              newWindowViewer.document.write("&lt;iframe width='100%' height='100%' src='" + attachmentMimeType + " " + encodeURI(attachBody) + "'&gt;&lt;/iframe&gt;");
          }
  </code></pre>