首页 > 解决方案 > TCPDF 180° 旋转文本,Y 轴错误?

问题描述

我想将旋转的文本放置在 A4 文档的底部,但我无法将其固定到低于此处的位置:

https://imgur.com/a/ltHkQW2

$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8');

    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('visioncode');
    $pdf->SetTitle('test');

    $pdf->setPrintFooter(false);
    $pdf->setPrintHeader(false);

    // set header and footer fonts
    $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

    // set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

    // set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

    // set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

    // set some language-dependent strings (optional)
    if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
        require_once(dirname(__FILE__).'/lang/eng.php');
        $pdf->setLanguageArray($l);
    }
    $pdf->setJPEGQuality(80);

    $pdf->AddPage();
    $pdf->SetFont('helvetica', 'B', 18);

    $pdf->WriteHTMLCell(94, 20, 5, 33, 'lorem ipsum lorem ipsum', 0, 0, false, true, 'C');

    $pdf->StartTransform();
    $pdf->Rotate(180);
    $pdf->SetY(0);
    $pdf->WriteHTML('lorem ipsum lorem ipsum');
    $pdf->StopTransform();

    $pdf->output(null, 'I');

如果我将 SetY 设置为负值,则文本将完全消失。不知道,如何在上面的屏幕截图中将文本设置得更低。

标签: phptcpdf

解决方案


推荐阅读