Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8549409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:42:24+00:00 2026-06-11T13:42:24+00:00

I am trying to create a PDF using droidText library. There I want to

  • 0

I am trying to create a PDF using droidText library. There I want to place some text content in the middle of the page but align to left. I was unable to do with Paragraph class and setAlignment() method. So I have decided to use TextField class. Below is the code I have used,

Document document = new Document(PageSize.A4);

try {

    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "TextFields.pdf"));

    document.open();

    TextField tf = new TextField(writer, new Rectangle(100, 300, 200, 350), "Content");
    tf.setText("This is the content of text field");
    tf.setAlignment(Element.ALIGN_CENTER);
    tf.setOptions(TextField.MULTILINE | TextField.REQUIRED);

    PdfFormField field = tf.getTextField();
    writer.addAnnotation(field);

} catch (DocumentException de) {
    System.err.println(de.getMessage());
} catch (IOException ioe) {
    System.err.println(ioe.getMessage());
}

document.close();

Code works perfect, but the out put PDF file that I am getting has this TextField which can be editable and also change the font appearance when I am click on the TextField. I don’t want that in to my final PDF. How can I remove that attribute? If it is not possible, is there any other way I can position some text in a PDF file using droidText library in Android?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:42:25+00:00Added an answer on June 11, 2026 at 1:42 pm
    1. You’re using a totally unsupported software library. See http://lowagie.com/iText2 There is an official Android port of the most recent iText version available at iText Software. It doesn’t need Apache Harmony, and it uses SpongyCastle instead of BouncyCastle to fix issue with clashing BC versions. See http://lowagie.com/iText2
    2. Seems like you want to add a Watermark. In that case, you don’t really need a TextField. The TextField object is used to create an interactive form (and you indicate that this isn’t what you want). The easiest way to add a Phrase in the middle of a page, is to use ColumnText.showTextAligned(). See the examples of chapter 3 of “iText in Action — Second Edition” for more info.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create Landscape PDF using iTextSharp but It is still showing
I am trying to create a PDF using iTextSharp library (version 4.1.2.0). At the
I'm trying to dynamically create a PDF using the TCPDF library in a document
I'm trying to dynamically create a PDF (on the server) with some text on
I am trying to create a pdf viewer but I can't separate view from
We're trying to create a .NET aspx page that will have a PDF within
i am trying to create a pdf email using data inputed into a html
I am trying to create a PDF file using struts 2.Action class location is
I'm trying to create Pdf from java using iText. How Can I Add two
I'm trying to create a pdf report using iTextSharp and I'm stumped as to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.