Googling you can see the source code for watermarking here https://github.com/microsoft/InvisMark