'PDFBox PDPageContentstream.setTextMatrix() making text disappear
I am converting POSPrint-data to a PDF. At one Point i need to strech the Text over 2 Lines, but with the width of the normal text. I'm trying to archive that like this:
CONTENT.beginText();
Matrix textMatrix = new Matrix();
textMatrix.scale(1f, 2f);
CONTENT.setTextMatrix(textMatrix);
CONTENT.newLineAtOffset(50, 50);
CONTENT.setCharacterSpacing(line.getLineSpacing());
CONTENT.showText(restOfLine);
CONTENT.endText();
sadly this results in the text not showing up at all. If i remove the lines for adding the textmatrix, or setting the matrix scale values to 1 this workes without any problem:
CONTENT.beginText();
Matrix textMatrix = new Matrix();
textMatrix.scale(1f, 1f);
CONTENT.setTextMatrix(textMatrix);
CONTENT.newLineAtOffset(50, 50);
CONTENT.setCharacterSpacing(line.getLineSpacing());
CONTENT.showText(restOfLine);
CONTENT.endText();
or
CONTENT.beginText();
CONTENT.newLineAtOffset(50, 50);
CONTENT.setCharacterSpacing(line.getLineSpacing());
CONTENT.showText(restOfLine);
CONTENT.endText();
Does anybody know why this happens?
I use PDFBox 2.0.25
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
