Skip to content

Commit 050c577

Browse files
author
Samuel Huylebroeck
committed
Add convenience method for setting textmatrix
Add convenience method taking an AffineTransform in PdfCanvas
1 parent 6586952 commit 050c577

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/canvas/PdfCanvas.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,16 @@ public PdfCanvas setTextMatrix(float a, float b, float c, float d, float x, floa
657657
.writeBytes(Tm);
658658
return this;
659659
}
660+
/**
661+
* Replaces the text matrix. Contrast with {@link PdfCanvas#concatMatrix}
662+
* @param transform new textmatrix as transformation
663+
* @return current canvas
664+
* */
665+
public PdfCanvas setTextMatrix(AffineTransform transform) {
666+
float[] matrix = new float[6];
667+
transform.getMatrix(matrix);
668+
return setTextMatrix(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
669+
}
660670

661671
/**
662672
* Changes the text matrix.

0 commit comments

Comments
 (0)