【问题标题】:PDF not using half the page - TCPDFPDF 不使用半页 - TCPDF
【发布时间】:2020-12-29 22:28:54
【问题描述】:

我正在尝试创建一个 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, 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');

【问题讨论】:

    标签: php pdf tcpdf


    【解决方案1】:

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

    我添加了这段代码。

    $pdf->SetAutoPageBreak(FALSE, 0);

    问题解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-26
      • 1970-01-01
      • 2017-05-11
      • 1970-01-01
      • 2013-09-29
      • 1970-01-01
      • 2011-12-27
      相关资源
      最近更新 更多