简体   繁体   English

PDF 不使用半页 - TCPDF

[英]PDF not using half the page - TCPDF

I am trying to create a pdf label - 2.4" x 2.4".我正在尝试创建 pdf label - 2.4" x 2.4"。 I am using TCPDF to create it, but I am having a tough time getting it to put the QR code at the bottom right.我正在使用 TCPDF 来创建它,但我很难让它把二维码放在右下角。 I can only get it into the middle of the label, any lower it puts it on another page.我只能把它放到 label 的中间,再低一点,它就会放在另一页上。

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, 0, 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,0),
    'bgcolor' => false
);

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

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

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

I needed to stop it from automatically breaking to a new page.我需要阻止它自动切换到新页面。

I added this code.我添加了这段代码。

$pdf->SetAutoPageBreak(FALSE, 0); $pdf->SetAutoPageBreak(FALSE, 0);

Problem solved.问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM