How to Rotate Text in Adobe Acrobat using Java

This brief tutorial guides on how to rotate text in Adobe Acrobat using Java. It provides details about the environment configuration, a step-by-step procedure to write the application, and a runnable sample code to rotate text in Adobe using Java. You will not only learn the process to rotate the text in the PDF but also get information about setting other properties of the text in the resultant output PDF file.

Steps to Rotate Text in Adobe Acrobat using Java

  1. Configure your project to add Aspose.PDF for Java for adding rotated text
  2. Instantiate a new document and add a default page to it
  3. Create a TextFragment class object by setting the text phrase to be rotated
  4. Set the text position, font, and rotation angle using relevant properties in the TextFragment object
  5. Instantiate a TextBuilder class object using the target page
  6. Append the text fragment and save the resultant PDF file

These steps summarize the process to rotate text in Acrobat using Java. First, you have to create a new PDF file, get the reference to a newly added page and create a TextFragment object by providing the text followed by setting the text font and rotation angle. In the final steps, a TextBuilder class object is created that requires reference to the page and provides features to append text fragments to the linked page.

Code to Rotate Text in PDF using Java

This code demonstrates the task to rotate text on PDF using Java. It uses a TextFragment object to set the text and its basic properties like font size, position, and rotation angle. You can also set other properties of text like horizontal alignment, vertical alignment, and hyperlink to name a very few.

This tutorial has guided us that how in Adobe rotate text using Java. If you want to learn other operations like adding a watermark to a PDF, refer to the article on how to add watermark to PDF using Java.

 English