如何解决在当前浏览器页面IE浏览器中直接下载PDF
我正在使用PHP创建强制在Internet Explorer当前页面中下载PDF文件。 PDF消息中显示的错误为Format error: Not a PDF or corrupted.
下面是我的示例代码:
<?PHP
header("Content-type: application-download");
header("Content-Length: $size");
header("Content-disposition: attachment; filename=MyPDF.pdf");
header("Content-transfer-encoding: binary");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1">
<div id="dvContainer">
This content needs to be printed.
</div>
</form>
</body>
</html>
PDF输出如下图所示:
我希望PDF中的预期结果如下图所示:
希望有人可以指导我哪里我做错了。谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。