DeepInJava
DeepInJava

Reputation: 1951

PDF Text Annotation Style Apply

I am new to PDFBox API. I would like to apply text annotation(AirPassengers) style like below marked in red box.

enter image description here

I am using PDF box API. I am creating text annotation as shown below.

PDAnnotationTextMarkup txtMark = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_FREETEXT);

This will result in Simple Text Annotation without any Style or background color. I would like to achieve the style as shown in screenshot. Anybody has any idea to achieve this.

Upvotes: 0

Views: 645

Answers (1)

Tilman Hausherr
Tilman Hausherr

Reputation: 18851

Do this:

txtMark.setColor(new PDColor(new float[] { 0, 1, 1 }, PDDeviceRGB.INSTANCE));

this sets the color you mentioned (#00FFFF). In Adobe Acrobat, colors are between 0 and 1 and not between 0 and 255. Be aware that the annotation will be visible in Adobe Reader, but at this time not in PDFBox rendering or PDF.js rendering because the Appearance Stream is missing (see my comment in your previous question).

Upvotes: 1

Related Questions