We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to add watermark visible only when printing document?

Hi


I use aspose-words-14.8.0-java and aspose-pdf-9.3.1-java.

I have doc, docx and pdf files that need to be converted to pdf-a. Also I need to add watermark that will be visible when printing, but not visible when viewing document in adobe reader.

Do I need to add layer that will be visible only while printing document (layer with print only usage)?

Can I do it with Aspose java API?

Any help would be greatly appreciate.
Ante


Hi Ante,

For Aspose.Words, there is no direct way but you can use the How to Add Watermark example and set the color so light that it is not visible to human eye but still printable by high resolution printers.

For Aspose.Pdf, you can use annotations for this purpose as you can see in the following code

com.aspose.pdf.Document doc = new com.aspose.pdf.Document("c:/pdftest/Release.pdf");

com.aspose.pdf.FreeTextAnnotation annotation = new com.aspose.pdf.FreeTextAnnotation(doc.getPages().get_Item(1), new com.aspose.pdf.Rectangle(50, 600, 250, 650), new DefaultAppearance("Helvetica", 16,new java.awt.Color(255,0,0)));

annotation.setContents("ABCDEFG");

annotation.getCharacteristics().setBorder(new java.awt.Color(255,0,0));

annotation.setFlags(AnnotationFlags.Print | AnnotationFlags.NoView);

doc.getPages().get_Item(1).getAnnotations().add(annotation);

doc.save("c:/pdftest/Annotation_Added_34838-out.pdf");<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

Best Regards,