【发布时间】:2014-03-07 16:40:04
【问题描述】:
我的 save.php 中有以下代码:
<?php
require_once("dompdf/dompdf_config.inc.php");
$LgPath=$_POST['image'];
header("Content-Transfer-Encoding: binary");
header("Content-Type: image/png");
//header("Content-Disposition: attachment; filename=image.png");
$html = file_get_contents($LgPath);
//$html = readfile($LgPath); --only shows the image
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
我成功地使用 HTML2CANVAS 获取某个元素的打印屏幕,然后使用 $POST 将其传递到 save.php 页面。我希望使用 DOMPDF 将该图像放入 sample.pdf 中。使用此代码,我在 sample.pdf“‰PNG”中只有此文本,我不知道如何修复它。使用 readfile 我看到了图像,但就是这样......有什么建议吗?谢谢。
【问题讨论】:
标签: pdf-generation dompdf html2canvas