We are having a problem with using Aspose Word to put a password on a document generated by HotDocs. When the document is generated by HotDocs it will allow Aspose to add a password to the RTF generated file. The problem is that when using Aspose Word to add the password to the RTF it will truncate part of the file. Without the Aspose Word adding the password the RTF document is complete.
We have been using Aspose Word to apply a password for some time to other HotDocs generated files but have not had any problems.
Have you ever seen this and if so what was the fix?
Here is the code used to apply the password to the RTF file:
// Apply the password here.
//
// Set the link to the template name for the user.
lnkDownloadDocument.Text = "Download " + _templateName;
// Open the document.
Document document = new Document(GetFilePathAndName(_fileName));
// Apply protection and password to the document.
document.Protect(ProtectionType.ReadOnly,WebConfigurationManager.AppSettings["WordPassword"]);
// Save the document.
document.Save(GetFilePathAndName(_fileName));
// Log to the database that the password was applied.
Utils.LogPasswordStatus(_fileName, _templateName, "Password has been added to the file.");