最新消息: 新版网站上线了!!!

mpdf自动分页加页码的方法

<?php


$mpdf=new mPDF();
$mpdf->WriteHTML('Your Introduction');
$mpdf->AddPage();
$mpdf->WriteHTML('Your Book text');

?>

例子二 #2 - 

<?php

$mpdf=new mPDF();
$mpdf->useOddEven = 1;
$mpdf->AddPage('','','1','i','on');
$mpdf->WriteHTML('Your Book text');

?>

例子三

<?php

$mpdf=new mPDF();
$mpdf->WriteHTML('Your Introduction');
$mpdf->AddPage('L','','','','',50,50,50,50,10,10);
$mpdf->WriteHTML('Your Book text');

?>

例子4

<?php

$mpdf=new mPDF();
$mpdf->useOddEven = 1;

$mpdf->defHeaderByName('myHeader', array (
    'L' => array (),
    'R' => array (),
    'C' => array ('content' => 'Chapter 2', 'font-style' => 'B', 'font-family' => 'serif'),
    'line' => 1,
    ));

$mpdf->defHTMLHeaderByName('myHeader2','<div style="text-align: center; font-weight: bold;">Chapter 2</div>');

$mpdf->WriteHTML('Your Introduction');

// Selects new headers for ODD and EVEN pages to use from the new page onwards
// Note the html_ prefix before the named HTML header
$mpdf->AddPage('','NEXT-ODD','','','','','','','','','', 'myHeader', 'html_myHeader2', '', '', 1, 1, 0, 0);

$mpdf->WriteHTML('Your Book text');

// Turns all headers/footers off from new page onwards
$mpdf->AddPage('','NEXT-ODD','','','','','','','','','','','','','',-1,-1,-1,-1);

$mpdf->WriteHTML('End section of book with no headers');

?>

转载请注明:谷谷点程序 » mpdf自动分页加页码的方法