Hi,
I’m currently using Aspose.Word version 15.12.0. I noticed when I create a document file with a watermark, if the document is saved as a PDF, the watermark becomes distorted. Is there a work around for this? I just tried the latest 16.xx jar and it seems to be fixed.
Also here is the sample code that i used to create the watermark. The code was taken from the sample section of the Aspose docs.
String path = “/Users/user/downloads/”;
Document document = new Document();
Shape watermark = new Shape(document, ShapeType.TEXT_PLAIN_TEXT);
watermark.getTextPath().setText(“SAMPLE”);
watermark.getTextPath().setFontFamily(“Arial”);
watermark.setWidth(500);
watermark.setHeight(100);
watermark.setRotation(-40);
watermark.getFill().setColor(Color.LIGHT_GRAY);
watermark.setStrokeColor(Color.LIGHT_GRAY);
watermark.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
watermark.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
watermark.setWrapType(WrapType.NONE);
watermark.setVerticalAlignment(VerticalAlignment.CENTER);
watermark.setHorizontalAlignment(HorizontalAlignment.CENTER);
Paragraph watermarkPara = new Paragraph(document);
watermarkPara.appendChild(watermark);
for (Section sect : document.getSections()) {
insertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HEADER_PRIMARY);
insertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HEADER_FIRST);
insertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HEADER_EVEN);
}
document.save(path + “test2.pdf”);
Thanks,
Telos