What are PDF ‘readonly’ text fields?

Once you start to explore the PDF file format you will find out something called ‘ReadOnly’ Text Fields. So what exactly are they and how can they be useful within a PDF?

PDF files contain text fields which allow you to enter text into. I am sure that is not a surprise and that they can be ReadOnly, so that a user cannot edit the text field.  Because they cannot be altered, they often include the details to display them as an image. This can be helpful in Java because that often means embedded fonts which can be used to generate an exact representation.

But are they really ‘readonly‘?

A user cannot directly edit a text field that is ReadOnly, but there is a way to alter the value of a ‘ReadOnly’ text field. Form fields can be updated not just by the user but also by Javascript within the PDF which is tied to an action. If there is an action within the PDF that sets the value of the ‘ReadOnly’ text field, thus altering the value of the text field and making ReadOnly rather more of a dynamic feature.

So a ‘ReadOnly’ text field is not truly Read Only.

Do you have any experience of these?

This post is part of our “Understanding the PDF File Format” series. In each article, we discuss a PDF feature, bug, gotcha or tip. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!

Related Posts:

The following two tabs change content below.
Chris developed much of the Forms handling code and also the hooks for the XFA.

About Chris Wade

Chris developed much of the Forms handling code and also the hooks for the XFA.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>