带有 dompdf 的垂直文本

vertical text with dompdf

我每次点击特定的内容时都使用 dompdf 生成合同 link,我需要做每个页面中存在的垂直边(如果合同 > 1page )但我不知道如何 谁能帮帮我?

简答

据我所知 dompdf 仅 CSS 2.1 兼容且旋转文本首次出现在 CSS3.

...嗯

您可以尝试的唯一技巧是使用 GD 创建包含您要旋转的文本的图片。 There is a nice example here 我在此处复制的内容,因为有时网站会离线并且链接会意外失效。

$label = "TEXT YOU WANT TO ROTATE";
$labelfont = 2;

// pixel-width of label
$txtsz = imagefontwidth($labelfont) * strlen($label);
// pixel-height of label
$txtht = imagefontheight($labelfont);

// define temp image
$labelimage = imagecreate($txtsz, $txtsz);
$white = imagecolorallocate($labelimage, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($labelimage, 0x00, 0x00, 0x00);

// write to the temp image
imagestring($labelimage, $labelfont, 0, $txtsz/2 - $txtht/2, $label , $black);

// rotate the temp image
$labelimage1 = imagerotate($labelimage, 90, $white);

// copy the temp image back to the real image
imagecopy($image, $labelimage1, 3, $vmargin + $ysize/2 - $txtsz/2, $txtsz/2 - $txtht/2, 0, $txtht, $txtsz);

// destroy temp images, clear memory
imagedestroy($labelimage);
imagedestroy($labelimage1);