Skip to content

AddImage is placed at 0,0 but oddly it is rotated around 0,height #3858

Open
@TheNextGuy32

Description

@TheNextGuy32
if (rotation) {
      this.internal.write(
        [1, "0", "0", 1, coord(x), vcoord(y + height), "cm"].join(" ")            // Why add height?
      ); //Translate
      this.internal.write(rotationTransformationMatrix.join(" "));
      this.internal.write(
        [coord(width), "0", "0", coord(height), "0", "0", "cm"].join(" ")
      ); //Scale

This is odd behavior in my opinion. If you place an image at 0,0 and rotate it 90 degrees it ends up very very far away from 0,0.

My preference would be rotation around the position it is drawn, I'd even take center rotation. Better yet give me an anchor point variable. Rotating an image means I also have to do complicated math to make sure the position is correct after the fact.

My solution has been to rotate the image with Jimp BEFORE handing it jspdf, which makes the logic more understandable, if computationally expensive.

I'm fully expected it to be "well its always been this way, I cant break our users' expectations" or "pdf's are weird like that bro" or some other Chestertons Fence I'm unaware of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions