Giter Site home page Giter Site logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
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 [email protected] on 10 Oct 2007 at 1:21

from alivepdf.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
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

from alivepdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.