Open GoogleCodeExporter opened 9 years ago
The Pear modification of the FPDF library includes a routine called
writeRotated().
I'm not sure if it will support any angle, but from the looks of it, it should.
I'm working on converting this, but since I haven't done too much with the
source
yet, I'm not exactly sure how it is going to work out. If anyone else would
like to
give it a shot, here's the method:
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 %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' .
FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' . FILE_PDF_FLOAT . ' %.2' .
FILE_PDF_FLOAT . ' 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);
}
Original comment by bustb...@gmail.com
on 10 Oct 2007 at 1:21
Hi bustback,
I have added a rotate method which is accepting a matrix. I will call it
transparently for all the different drawing methodds (addImage, addCell,
addText, etc).
Give me a few days and I'll post an update ;)
Thanks !
Original comment by thibault.imbert
on 10 Oct 2007 at 11:25
Original issue reported on code.google.com by
bustb...@gmail.com
on 10 Oct 2007 at 1:10