简体   繁体   English

PDF 到 base64 转换器和查看 base64

[英]PDF to base64 converter and viewing base64

I am getting a PDF file via JSON and this file is coming in base64 in a string.我正在通过 JSON 获取一个 PDF 文件,并且该文件以字符串形式出现在 base64 中。 I wanted to test this base64 to see if it mounts the PDF correctly.我想测试这个 base64 以查看它是否正确安装了 PDF。 How could he do that?他怎么能这样?

Try it by throwing it in HTML file.将其放入 HTML 文件中尝试一下。 I had the exact same requirement and this was the easiest method I found ...我有完全相同的要求,这是我发现的最简单的方法......

<html>
    <body>
        <embed style="height: 100%; width: 100%;" src="data:application/pdf;base64,YOUR_BASE64_STRING_GOES_HERE" type="application/pdf"></object>
    </body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM