Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Created September 25, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/ba95d278904ea8ab77c59a37a216fc1f to your computer and use it in GitHub Desktop.
Save GroupDocsGists/ba95d278904ea8ab77c59a37a216fc1f to your computer and use it in GitHub Desktop.
string password = "iamironman";
Stream openFile = new FileStream(sourceFile, FileMode.Open);
DocumentResult result = new DocumentHandler().AddPassword(openFile, password);
Stream documentStream = result.Stream;
var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + result.FileFormat);
documentStream.CopyTo(fileStream);
documentStream.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment