【问题标题】:Embedded base64 pdf won't display in IE when using iframe使用 iframe 时,嵌入式 base64 pdf 不会在 IE 中显示
【发布时间】:2013-05-27 07:09:26
【问题描述】:

我希望在 html 中显示一个使用 base64 编码嵌入的 pdf 文件。 下面是我为此编写的代码。 pdf 文件在 Chrome 和 firefox 中显示,但在 Internet Explorer 中不显示。

知道如何让它在 IE 中运行吗? Adobe Reader 插件对我来说在 IE 中正常工作。

<iframe src="data:application/pdf;base64,baseEncodedString"></iframe>

由于字符限制,我无法粘贴基本编码字符串。但它的大小为 401676 个字符。

【问题讨论】:

标签: html pdf iframe embed


【解决方案1】:

除了“它”是一个糟糕的解决方案之外,我会这样做:

<iframe src="/unbase64.php?mime=application/pdf&str=baseEncodedString"></iframe>

然后

<?php
header("Content-Type: " . $_GET["mime"]);
echo base64_decode($_GET["str"]);
?>

很愚蠢,可能会经常达到最大 URL 长度,但它在原则上是有效的。

【讨论】:

    猜你喜欢
    • 2012-08-16
    • 2020-07-28
    • 2020-06-03
    • 2016-11-30
    • 2012-11-04
    • 2015-03-13
    • 1970-01-01
    • 1970-01-01
    • 2017-02-21
    相关资源
    最近更新 更多