Inserting watermark in pdf

Hi,
if I insert a watermark into a document and then save it as a pdf. The watermark is not displayed in the document. When saving the document as .doc all looks well.

This is how I insert the watermark:

// Create a watermark shape. This will be a WordArt shape.
Shape watermark = new Shape(document, ShapeType.TEXT_PLAIN_TEXT);
// Set up the text of the watermark.
watermark.getTextPath().setText(watermarkText);
watermark.getTextPath().setFontFamily("Arial");
watermark.setWidth(500);
watermark.setHeight(400);
// Text will be directed from the bottom-left to the top-right corner.
watermark.setRotation(-45);
// Remove the following two lines if you need a solid black text.
watermark.getFill().setColor(Color.LIGHT_GRAY);
watermark.setStrokeColor(Color.LIGHT_GRAY);
// Place the watermark in the page center.
watermark.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
watermark.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
watermark.setWrapType(WrapType.NONE);
watermark.setVerticalAlignment(VerticalAlignment.CENTER);
watermark.setHorizontalAlignment(HorizontalAlignment.CENTER);
// Create a new paragraph and append the watermark to this paragraph.
Paragraph watermarkPara = new Paragraph(document);

watermarkPara.appendChild(watermark);

Is there anything wrong with this code?

Hi
Thanks for your request. The problem occurs because Aspose.Words for Java does not support rendering of WordArt shapes.
As a workaround, you can insert watermark as an image. In this case it will look correct. You can find code examples here:
https://forum.aspose.com/t/123722
Hope this helps. Please let me know if you need more assistance, I will be glad to help you.
Best regards,

The issues you have found earlier (filed as WORDSJAVA-35) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(17)