Horde_Pdf_Writer::writeRotated PHP Method

writeRotated() public method

All coordinates can be negative to provide values from the right or bottom edge of the page (since File_Pdf 0.2.0, Horde 3.2).
See also: setFont()
public writeRotated ( integer $x, integer $y, string $text, float $text_angle, float $font_angle )
$x integer X coordinate.
$y integer Y coordinate.
$text string Text to write.
$text_angle float Angle to rotate (Eg. 90 = bottom to top).
$font_angle float Rotate characters as well as text.
    public function writeRotated($x, $y, $text, $text_angle, $font_angle = 0)
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }
        // Escape text.
        $text = $this->_escape($text);
        $font_angle += 90 + $text_angle;
        $text_angle *= M_PI / 180;
        $font_angle *= M_PI / 180;
        $text_dx = cos($text_angle);
        $text_dy = sin($text_angle);
        $font_dx = cos($font_angle);
        $font_dy = sin($font_angle);
        $s = sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET', $text_dx, $text_dy, $font_dx, $font_dy, $x * $this->_scale, ($this->h - $y) * $this->_scale, $text);
        if ($this->_draw_color) {
            $s = 'q ' . $this->_draw_color . ' ' . $s . ' Q';
        }
        $this->_out($s);
    }