如何将通过HTML2PDF生成的pdf文件的页面方向更改为横向...?默认情况下,它以肖像格式打开。我已经在html2pdf.class中对其进行了更改,但没有changed.Please帮助我..
这是php代码:
require('../../includes/html2pdf/html2fpdf.php');
$pdf=new HTML2FPDF('L','mm','A3');
$pdf->AddPage();
$pdf->setFont("arial",'',8);
$pdf->WriteHTML($data);
$pdf->Output("outstanding.pdf","I");发布于 2013-07-12 02:30:39
使用L作为构造函数参数应该可以很好地工作。不要弄乱类的内部结构。
这是我唯一的代码,它工作得很好。尝试使用最新版本:HTML2PDF。
// convert to PDF
require_once('../../vendor/html2pdf_v4.03/html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('L', 'A4', 'en');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($html, false);
$html2pdf->Output('output.pdf', 'D');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}发布于 2014-06-04 11:10:32
或者,您可以在标签上添加方向。
<page orientation="landscape" format="A5" > Landscape </page>有关更多示例,请查看http://demo.html2pdf.fr/examples/pdf/exemple04.pdf。
发布于 2019-04-23 02:00:09
这个解决方案也非常好,文档中有:
var element = document.getElementById('element-to-print');
var opt = {
margin: 1,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
// New Promise-based usage:
html2pdf().set(opt).from(element).save();
// Old monolithic-style usage:
html2pdf(element, opt);https://stackoverflow.com/questions/15084329
复制相似问题