PDF 未使用一半页面 - TCPDF

问题描述

我正在尝试创建一个 pdf 标签 - 2.4" x 2.4"。我正在使用 TCPDF 来创建它,但我很难让它将二维码放在右下角。我只能把它放在标签的中间,任何较低的地方都会把它放在另一个页面上。

require_once('tcpdf_include.PHP');
            
$pdf = new TCPDF('L','mm',array('64','64'),true,'UTF-8',false);

$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Me');
$pdf->SetTitle('Tag');

$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
 
$pdf->SetMargins(0,true);

$pdf->AddPage();

$toolcopy = '<span style="font-size:34px">'.$cate[$id]['short'].'-'.$string.'</span><br/>';
            
$toolcopy .='<span style="font-size:10px;text-align:left;">Category: '.$cate[$id]['long'].'<br/>Date: '.date('m/d/Y',strtotime($date)).'
                </span>';
    
            
$style = array(
    'border' => false,'vpadding' => 'auto','hpadding' => 'auto','fgcolor' => array(0,0),'bgcolor' => false
);

$codes = 'website';
            
$pdf->writeHTML($toolcopy,false,'L');
$pdf->write2DBarcode($codes,'QRCODE,L',30,15,25,$style,'N');
           
$filename = $string.".pdf"; 

$filelocation = dirname(__FILE__)."/labels"; 
$fileNL = $filelocation."/".$filename; 

$pdf->Output($fileNL,'F');

解决方法

我需要阻止它自动跳转到新页面。

我添加了此代码。

$pdf->SetAutoPageBreak(FALSE,0);

问题解决了。