Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ldenoue opened this issue Mar 28, 2013 · 0 comments
Open

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

ldenoue opened this issue Mar 28, 2013 · 0 comments

Comments

@ldenoue
Copy link

ldenoue commented Mar 28, 2013

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);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant