Skip to content

Selection.m width: a fix for rotated pages #68

@ldenoue

Description

@ldenoue

Sometimes on rotated pdf files the textMatrix.a is 0.
An example is here: http://94.23.146.173/ficheros/d412df0c4d6c05406e5dd5757ea63ae1.pdf

In these cases, we need to return the vertical.

CGFloat vertical(CGAffineTransform transform) {
return transform.ty / transform.b;
}

  • (CGFloat)width {
    CGFloat a = self.finalState.textMatrix.a;
    CGFloat a2 = self.initialState.textMatrix.a;
    if (a == 0 || a2 == 0)
    return vertical(self.finalState.textMatrix) - vertical(self.initialState.textMatrix);
    else
    return horizontal(self.finalState.textMatrix) - horizontal(self.initialState.textMatrix);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions