我如何改变我的方向pdf
生成的文件Wkhtmltopdf
。我在 PHP 中调用它,如下所示:
$file = fopen("tmp/html/pdfTmp_$numRand.html",
"w") or exit("Unable to open file!");
fwrite($file, $html);
fclose($file);
exec("..\library\wkhtmltopdf\wkhtmltopdf " .
"tmp/html/pdfTmp_$numRand.html tmp/pdf/pdfTmp_$numRand.pdf");
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=".$nom."_".$residence.".pdf");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize("tmp/pdf/pdfTmp_$numRand.pdf"));
ob_clean();
flush();
readfile("tmp/pdf/pdfTmp_$numRand.pdf");
$html
包含我的整个 html 页面,这将打开一个临时文件。
这会生成一个.pdf
纵向。我知道 wkhtlktopdf 有一个选项-O landscape
改变方向,但我不知道在我的 PHP 脚本中在哪里以及如何编写它。我使用的是 Windows 7。
Option -O landscape
会成功的。
只是改变
exec("..\library\wkhtmltopdf\wkhtmltopdf tmp/html/pdfTmp_$numRand.html tmp/pdf/pdfTmp_$numRand.pdf");
类似的东西
exec("..\library\wkhtmltopdf\wkhtmltopdf -O landscape tmp/html/pdfTmp_$numRand.html tmp/pdf/pdfTmp_$numRand.pdf");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)