I need to know in which version of Aspose.PDF for Java was introduced the ability to write rotated text.
For production needs I have to write rotated text using version 10.8 of Aspose.PDF for Java, but I’m unable to find the right way.
Thank you
Fabio Parise
Can you please specify what you mean by ‘the right way’ to write rotated text? Are you looking for code examples or specific methods?
I’m looking a code example working with version 10.8.
We are afraid that you are using quite an old version of the API. A lot of classes and APIs have been obsolete and discontinued since then. We recommend using the latest available version of the API as we provide support on it basis. To add rotated text in PDF using Aspose.PDF for Java 24.10, please check below article:
So do you confirm that using the setRotate method is the only way to get rotated text using Aspose.PDF?
Is there the possibility to apply an affine transformation to a text that have to be added to a PDF document?
Yes, setRotate method is the only and primary approach in Aspose.PDF to set rotation for the text. However, if it does not suit you OR you are looking for some other workaround, please let us know some more details. We will further proceed to assist you accordingly.
What I need is the ability to apply an affine transformation to a sort of stamp made up of text and lines that are to be placed on a document. I have to convert code written with iText 2.x to Aspose.PDF.
This is an example of the code written with iText that I need to convert:
// Create the affine transform based on parameters
AffineTransform localStampTransformation = AffineTransform.getRotateInstance(
this.getAngleRad(), 0, 0 );
localStampTransformation.concatenate( AffineTransform.getScaleInstance(
this.xScale, this.yScale
));
localStampTransformation.concatenate( AffineTransform.getTranslateInstance(
- stamp.getPreferredSize().getWidth() / 2.0,
+ stamp.getPreferredSize().getHeight() / 2.0
));
// canvas is an instance of PdfContentByte containing the stamp
// writing stamp text..
canvas.beginText();
canvas.setFontAndSize(font, fontSize);
canvas.setColorFill(color);
canvas.showText(text);
canvas.endText();
// drawing stamp lines...
canvas.setColorStroke(strokeColor);
canvas.setLineWidth(lineWidth);
canvas.moveTo(x1, y1);
canvas.lineTo(x2, y2);
canvas.stroke();
... more
// applying Affine Transform to move, rotate and scale the stamp
canvas.transform(localStampTransformation);
Thank you
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFJAVA-44480
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.