<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ShowPDF.aspx.vb" Inherits="EnsinoBasico.ShowPDF" %>

<body>
    <div id="myIframeContainer" runat="server">
        <iframe name="<%#name %>"
            frameborder="0"
            marginheight="0"
            marginwidth="0"
            width="100%"
            height="100%"
            scrolling="auto"
            id="myIframe"></iframe>
    </div>

    <div id="htmlWordContainer" runat="server" />

</body>

<script>
    var blob = base64ToBlob("<%#base64File %>");
    var blob_url = URL.createObjectURL(blob);

    document.getElementById("myIframe").setAttribute('src', blob_url);

    function base64ToBlob(base64) {
        const binStr = atob(base64);
        const len = binStr.length;
        const arr = new Uint8Array(len);

        for (let i = 0; i < len; i++) {
            arr[i] = binStr.charCodeAt(i);
        }

        return new Blob([arr], { type: "<%#contentTypeX %>" });
    }
</script>