Hi,

Is it possible to add an annotation that contains text, for example "This
is a very long string and I want to display this string in a multiline
annotation", and I want to define a box of 150 pixels width. So then the
text displaying on  multiple lines.

At this time I am using

PDAnnotationRubberStamp stamp = new PDAnnotationRubberStamp();

...

PDRectangle rect = new PDRectangle(viktaAnnotation.getX(), ph -
annotation.getY() - heightTranslate, objectWidth, objectHeight);
stamp.setRectangle(rect);


PDAppearanceStream appearanceStream = new PDAppearanceStream(doc);

...

appearanceStream.setBBox(new PDRectangle(150, 200));

...

contentStream.beginText();
contentStream.setTextMatrix(Matrix.getTranslateInstance(0, heightTranslate));
contentStream.showText("This is a very long string and I want to
display this string in a multiline annotation");
contentStream.endText();

...

PDAppearanceDictionary appearance = new PDAppearanceDictionary();
appearance.setNormalAppearance(appearanceStream);
stamp.setAppearance(appearance);
stamp.setIntent(PDAnnotationRubberStamp.IT_FREE_TEXT);

annotations.add(stamp);
page.setAnnotations(annotations);



Best regards,
Fred

Reply via email to