php – 使用wkhtmltopdf设置横向

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 使用wkhtmltopdf设置横向脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我如何改变WkhtMLtopDF生成的pdf文件方向.我在 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景观来改变方向,但是我不知道我在哪里和如何写我的PHP脚本.我正在使用Windows 7.

选项-O景观会做的伎俩.

只是chage

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");

脚本宝典总结

以上是脚本宝典为你收集整理的php – 使用wkhtmltopdf设置横向全部内容,希望文章能够帮你解决php – 使用wkhtmltopdf设置横向所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。