我的分页有一点问题。 Multicell 显示在第一页的页脚上方,然后中断:How can I set the bottom margin of the page so that break happened earlier above?这是示例 PDF:Example这里是源代码:
<?php require_once('../tcpdf/config/lang/eng.php');
require_once('../tcpdf//tcpdf.php');
class MYPDF extends TCPDF {
public function Header() {
$auto_page_break = $this->AutoPageBreak;
$this->SetAutoPageBreak(false,0);
$this->setJPEGQuality(100); $img_file = 'images/mandanten/ce_background.jpg';
$this->Image($img_file, $x=160, $y=72, $w=36, $h=200, $type='', $link='', $align='', $resize=true, $dpi=150, $palign='', $ismask=false, $imgmask=false, $border=0);
$this->SetAutoPageBreak($auto_page_break); }
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('tmpAutor');
$pdf->SetTitle('tmpTitle'); $pdf->SetSubject('tmpSubject');
$pdf->SetKeywords('tmp'); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, 10, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(True, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->AddPage();
$pdf->SetFont('freesans', '', 16);
$pdf->Cell(0, 10, 'Headline', 0, 1, 'L');
$pdf->SetFont('freesans', '', 11);
// Some Dummy Unicode content
$tmp = 'Lorèm ìpsum dolor sìt åmèt, čonsètètur sådìpsčìng èlìtr, sèd dìåm nonumy èìrmod tèmpor ìnvìdunt ut låborè èt dolorè mågnå ålìquyåm èråt, sèd dìåm voluptuå. åt vèro èos èt åččusåm èt justo duo dolorès èt èå rèbum. Stèt člìtå kåsd gubèrgrèn, no sèå tåkìmåtå sånčtus èst Lorèm ìpsum dolor sìt åmèt. Lorèm ìpsum dolor sìt åmèt, čonsètètur sådìpsčìng èlìtr, sèd dìåm nonumy èìrmod tèmpor ìnvìdunt ut låborè èt dolorè mågnå ålìquyåm èråt, sèd dìåm voluptuå. åt vèro èos èt åččusåm èt justo duo dolorès èt èå rèbum. Stèt člìtå kåsd gubèrgrèn, no sèå tåkìmåtå sånčtus èst Lorèm ìpsum dolor sìt åmèt.wåèdr';
$pdf->MultiCell(140, 0, $tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp."<br><br>".$tmp, 0, 'J', 0, 0, '', '', true, 0,true);
$pdf->Output('example_051.pdf', 'I');
最佳答案
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(True, PDF_MARGIN_BOTTOM);
你试过吗:
$pdf->SetAutoPageBreak(True, PDF_MARGIN_FOOTER);
或
$pdf->SetAutoPageBreak(True, where_I_want_break);
关于php - tcpdf 分页问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2092089/