[jira] [Commented] (PDFBOX-4126) TextPosition exact angle position
[ https://issues.apache.org/jira/browse/PDFBOX-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16375720#comment-16375720 ] Alexandre commented on PDFBOX-4126: --- Yes indeed, I think there is no usage in PDFBox at the moment but some people where looking for the right answers, and so do I. A. > TextPosition exact angle position > - > > Key: PDFBOX-4126 > URL: https://issues.apache.org/jira/browse/PDFBOX-4126 > Project: PDFBox > Issue Type: Improvement > Components: Text extraction >Affects Versions: 2.0.8 >Reporter: Alexandre >Priority: Minor > Attachments: test_rotation.pdf > > > Dear Apache contributors, > Is there an efficient way to get the exact angle in radians or degrees of a > TextPosition, not only the ranges (0, 90, 180, 270). Basically, what we have > currently uses the following information. > > {code:java} > float a = textMatrix.getScaleY(); > float b = textMatrix.getShearY(); > float c = textMatrix.getShearX(); > float d = textMatrix.getScaleX(); > {code} > Hagd, A. > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4126) TextPosition exact angle position
[ https://issues.apache.org/jira/browse/PDFBOX-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16375719#comment-16375719 ] Tilman Hausherr commented on PDFBOX-4126: - Does this mean your problem is solved? I don't see a need to put this within PDFBox. > TextPosition exact angle position > - > > Key: PDFBOX-4126 > URL: https://issues.apache.org/jira/browse/PDFBOX-4126 > Project: PDFBox > Issue Type: Improvement > Components: Text extraction >Affects Versions: 2.0.8 >Reporter: Alexandre >Priority: Minor > Attachments: test_rotation.pdf > > > Dear Apache contributors, > Is there an efficient way to get the exact angle in radians or degrees of a > TextPosition, not only the ranges (0, 90, 180, 270). Basically, what we have > currently uses the following information. > > {code:java} > float a = textMatrix.getScaleY(); > float b = textMatrix.getShearY(); > float c = textMatrix.getShearX(); > float d = textMatrix.getScaleX(); > {code} > Hagd, A. > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4126) TextPosition exact angle position
[ https://issues.apache.org/jira/browse/PDFBOX-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16375700#comment-16375700 ] Alexandre commented on PDFBOX-4126: --- More generally... {code:java} import org.apache.mahout.math.QRDecomposition; import org.apache.mahout.math.DenseMatrix; import org.apache.mahout.math.*; import org.apache.pdfbox.text.TextPosition; public class TextPositionAdvanced { TextPosition _textPosition; DenseMatrix _denseMatrix; QRDecomposition _qr; public TextPositionAdvanced(TextPosition textPosition) { _textPosition = textPosition; org.apache.pdfbox.util.Matrix matrix = _textPosition.getTextMatrix(); _denseMatrix = new DenseMatrix(3,3); _denseMatrix.set(0, 0, matrix.getScaleX()); // a _denseMatrix.set(0, 1, matrix.getShearY()); // b _denseMatrix.set(0, 2, 0); _denseMatrix.set(1, 0, matrix.getShearX()); // c _denseMatrix.set(1, 1, matrix.getScaleY()); // d _denseMatrix.set(1, 2, 0); _denseMatrix.set(2, 0, matrix.getTranslateX()); // tx _denseMatrix.set(2, 1, matrix.getTranslateY()); // ty _denseMatrix.set(2, 2, 1); _qr = new QRDecomposition(_denseMatrix.transpose()); } public String toString() { return _textPosition.toString() + "angle: " + this.getAngle(); } public double getAngle() { return this.getEulerAngles(_qr.getQ()); } public double getEulerAngles(Matrix R) { return Math.toDegrees(Math.atan2(-R.get(0, 1), R.get(0, 0))); } } {code} > TextPosition exact angle position > - > > Key: PDFBOX-4126 > URL: https://issues.apache.org/jira/browse/PDFBOX-4126 > Project: PDFBox > Issue Type: Improvement > Components: Text extraction >Affects Versions: 2.0.8 >Reporter: Alexandre >Priority: Minor > Attachments: test_rotation.pdf > > > Dear Apache contributors, > Is there an efficient way to get the exact angle in radians or degrees of a > TextPosition, not only the ranges (0, 90, 180, 270). Basically, what we have > currently uses the following information. > > {code:java} > float a = textMatrix.getScaleY(); > float b = textMatrix.getShearY(); > float c = textMatrix.getShearX(); > float d = textMatrix.getScaleX(); > {code} > Hagd, A. > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4126) TextPosition exact angle position
[ https://issues.apache.org/jira/browse/PDFBOX-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16375675#comment-16375675 ] Tilman Hausherr commented on PDFBOX-4126: - https://stackoverflow.com/questions/21561909/finding-angle-from-transform-matrix > TextPosition exact angle position > - > > Key: PDFBOX-4126 > URL: https://issues.apache.org/jira/browse/PDFBOX-4126 > Project: PDFBox > Issue Type: Improvement > Components: Text extraction >Affects Versions: 2.0.8 >Reporter: Alexandre >Priority: Minor > Attachments: test_rotation.pdf > > > Dear Apache contributors, > Is there an efficient way to get the exact angle in radians or degrees of a > TextPosition, not only the ranges (0, 90, 180, 270). Basically, what we have > currently uses the following information. > > {code:java} > float a = textMatrix.getScaleY(); > float b = textMatrix.getShearY(); > float c = textMatrix.getShearX(); > float d = textMatrix.getScaleX(); > {code} > Hagd, A. > -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org