At IDR Solutions this month I have spent time re-coding our AP Streams code for our PDF parser in the JPedal Java PDF Library SDK. I have learnt about Appearance Streams in more detail. There is a lot of detail involved in AP Streams so I would like to share my knowledge on AP Streams with you.
What are AP Streams?
AP Streams, or Appearance Streams are embedded PDF streams inside PDF files that enable you to display better visual and interactive content. They can consist of anything that can visually be displayed, whether they are checkboxes, logos, fancy text, radio buttons, etc. This means that their sizes can be as small as needed and can have multiple AP Streams within a PDF file. The visual display of the stream can change instantly when clicked which makes PDF files interactive.
Why AP Streams?
So why do we need AP Streams? You can just show the text value for a Form Object but often you want something more flexible and slick. We can easily create our own images and code the PDF to show far more than just plain text. This means we can choose to have a big red ‘X’ instead of an empty checkbox or a bigger blue exclamation mark in the text.
How do AP Streams work?
An AP Stream consists of 3 keys: Normal (N), Down (D), and a Rollover (R) key. The N value is the normal appearance of the object; the R value is the appearance of the object when the mouse is hovered over it; the D value is the appearance when the object is being pressed on by the mouse. While the N key must have a value, the R and D keys are optional.
An AP Stream also has 2 states. Although these 2 states can be anything, they are generally named ‘On’ and ‘Off’. AP Streams alternate between these 2 states, displaying different images for each state. For example, the ‘Yes’ state in the below example might display a checkbox with a tick while the ‘Off’ state would display a checkbox without a tick.
In conclusion, AP streams are one of those PDF features which allows us to build high quality documents for our users to display. Are you using them?
Latest posts by Zain (see all)
- Using Zendesk or Jira Service Desk to provide customer support - July 20, 2017
- Java 9 JShell explained in 5 minutes - May 11, 2017
- Java 9 Modularity explained in 5 minutes - May 4, 2017
- Key takeaways from NetBeans Day UK 2017 - April 26, 2017
- Why IDRsolutions uses the NetBeans IDE for Java Development - April 18, 2017