dongzhabo2796 2017-01-05 20:12
浏览 435

TCPDF中的HTML和不同的边距

I am trying to create a PDF (TCPDF library), using the "writeHTML" method to fill 4 pages of HTML content fine. The problem was that i need to use a 5cm left margin in the pair pages and a 5cm right margin in the impair pages, but the writeHTML only get the default margins of the page and i cant change it.

i use this sample code:

ob_start();
require_once('../classes/TCPDF-master/tcpdf.php');

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//add page
$pdf->AddPage('P', 'A4');
//set first margin
$pdf->SetMargins(50, 10, 10); //margin from left
//write html
$pdf->writeHTML('some html that fills 4 pages', true, false, true, false, '');
//output
$pdf->Output('example_006.pdf', 'I');

I need to change the margins of impair pages to:

$pdf->SetMargins(10, 10, 50);

How can i do that?

thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?