转换同一页面PDF
我想同样的文档转换为PDF或我要在URL添加POST方法就像:转换同一页面PDF
$dompdf->loadHtml($_POST['name']);
下面是代码:
<?php
// include autoloader
require_once 'dompdf/autoload.inc.php';
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml(file_get_contents('http://localhost/));
// (Optional) Setup the paper size and orientation
$dompdf->setPaper(array(0,0,850,2250), 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
//$dompdf->stream();
// Output the generated PDF (1 = download and 0 = preview)
$dompdf->stream("codex",array("Attachment"=>0));
?>
你'如果file_get_contents丢失了单引号if file_get_contents
<?php
// include autoloader
require_once 'dompdf/autoload.inc.php';
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml(file_get_contents('http://localhost/'));
// (Optional) Setup the paper size and orientation
$dompdf->setPaper(array(0,0,850,2250), 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
//$dompdf->stream();
// Output the generated PDF (1 = download and 0 = preview)
$dompdf->stream("codex",array("Attachment"=>0));
?>
已经在一条评论。这实际上并没有试图回答这个问题! – RiggsFolly
在发表评论之前,我开始输入答案并在评论后发布。顺便说一句,如果你注意到报价缺失,它会工作吗?绝对没有。如果我正在纠正它,没有任何意见可以降低它。我正在回答正确的方向。 –
___句子2:___这并不试图回答问题 – RiggsFolly
对,这是什么问题? – RiggsFolly
你是否看到缺少的单引号?颜色编码告诉你有一个问题 – RiggsFolly
没有没有任何问题,我可以使用这个URL创建一个PDF,但我想在这里添加Post方法,所以我可以在这里添加来自HTML的URL –