PDF library tcpdf in landscape orientation and pdf->SetXY doesn't work as expected?

后端 未结 1 857
离开以前
离开以前 2021-01-28 09:04

I can not figure this one out how tcpdf recalculates x and y coordinates if orientation is landscape. The only way i can get a bit of control is to put text in a writeHTML

1条回答
  •  我在风中等你
    2021-01-28 09:31

    For those in the same situation in my case $pdf->MultiCell did the job as I don't know how many characters a name will have. And using a table cell would not let me display a name on multiline

      $style = array(
        'border' => false,
        'padding' => 'auto',
        'fgcolor' => array(0, 0, 0),
        'bgcolor' => false
    );
    $pdf->SetXY(0, 0);
    $pdf->write2DBarcode('http://www.google.com/', 'QRCODE,H', 0, 1, 40, 40, $style, 'N');
    // set text content
    $pdf->SetXY(42, 7);
    
    $pdf->SetFontSize(10);
    //
    $textData = '

    Matthew Pitt

    ' . '

    Google Light Company

    '; //$pdf->writeHTML($textData, true, false, false, false, 'L'); $pdf->SetXY(40, 7); $htmlHead = '
    Matthew Pitt Matthew Pitt Matthew Pitt
    Good Light Company
    '; //$pdf->writeHTML($htmlHead, true, false, true, false, '');//<- check this didn't work 100% correctly $txt = 'Matthew Pitt Matthew Pitt Matthew Pitt Matthew Pitt Matthew Pitt Matthew Pitt'; $pdf->MultiCell(45, 5, $txt, 0, '', 0, 1, '', '', true); $pdf->Ln(1); $pdf->SetX(40); $txt2 = 'Google Company Light'; $pdf->MultiCell(45, 5, $txt2, 0, '', 0, 1, '', '', true);

    0 讨论(0)
提交回复
热议问题