HTML 页面中 PDF 文件的 MIME 编码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11551197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MIME encoding of a PDF file in an HTML page
提问by user1536245
Can a PDF be MIME encoded and included as part of the payload of an HTML page? This site shows that you can include a MIME-encoded image or a CSS in an HTML page: http://www.greywyvern.com/code/php/binary2base64/-- but I don't know what the markup would be for an encoded PDF included in an HTML page. Thanks.
PDF 是否可以进行 MIME 编码并作为 HTML 页面的有效负载的一部分包含在内?此站点显示您可以在 HTML 页面中包含 MIME 编码的图像或 CSS:http: //www.greywyvern.com/code/php/binary2base64/-- 但我不知道标记的用途包含在 HTML 页面中的编码 PDF。谢谢。
回答by Musa
I've tried it with iframe
and embed
, worked in chrome, opera and safari, no ie or ff
我已经用iframe
and试过了embed
,在 chrome、opera 和 safari 中工作过,没有 ie 或 ff
<iframe src="data:application/pdf;base64,base64encodedpdf"></iframe>
<embed src="data:application/pdf;base64,base64encodedpdf">
http://jsfiddle.net/yLx2W/
http://jsfiddle.net/yLx2W/1/
http://jsfiddle.net/yLx2W/
http://jsfiddle.net/yLx2W/1/
Maybe with some tweaking you can get them to work for ff and maybe ie.
也许通过一些调整,你可以让它们为 ff 工作,也许 ie。