Load the password-protected documents

On this page

GroupDocs.Annotation allows you to annotate documents that are protected with a password.

To load a password protected file, follow these steps:

  1. Instantiate the Annotator class. Specify the document path or stream.
  2. Instantiate the LoadOptions class. Specify the source document password as a parameter.

The following code snippet shows how to load a password protected file:

using (Annotator annotator = new Annotator("input.pdf", new LoadOptions() { Password = "1234" }))
{
 	AreaAnnotation area = new AreaAnnotation()
    {
       	Box = new Rectangle(100, 100, 100, 100),
       	BackgroundColor = 65535,
    };
    annotator.Add(area);
    annotator.Save("result.pdf");
}

On this page