Free Support Forum - groupdocs.com

WaterMark in protected PDF


#1

Hi Team,

I couldn’t find any functionality like

I would like to apply watermark on password protected files. Could you please let me know if i missed something.

If this fucntionality exists. Pls share me the Class/methods to do the same.

Thanks,
Sushil


#2

@sushil8282,

GroupDocs.Watermark contains LoadOptions class to provide password for the password protected documents. You can set the Password property of the LoadOptions class and pass it to Document.Load method as shown in the following code snippets. In case the password is incorrect, InvalidPasswordException is thrown.
C#

// Use LoadOptions instance to pass the password
LoadOptions loadOptions = new LoadOptions();
loadOptions.Password = "123";
using (Document doc = Document.Load(@"C:\test.pdf", loadOptions))
{
       //Perform watermarking operation on document
}

Java

//Create LoadOption instance
LoadOptions loadOptions = new LoadOptions();
loadOptions.setPassword("123");
Document doc = Document.load("C:\test.pdf", loadOptions); 
//Perform watermark operation on document.