Approved
Last Updated: 28 Jan 2019 15:02 by ADMIN
ADMIN
Tanya
Created on: 05 Apr 2018 14:11
Category: WordsProcessing
Type: Feature Request
3
WordsProcessing: DocxFormatProvider: Implement encryption of a document
Allow to password-protect a document, so that it cannot be shown (read) without the password.

Workaround: PdfProcessing can be used to encrypt the document:

using (MemoryStream ms = new MemoryStream())
{
    PdfFormatProvider pdfProcessingFormatProvider = new PdfFormatProvider();
    Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfFormatProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
    pdfFormatProvider.Export(flowDocument, ms);
    RadFixedDocument fixedDocument = pdfProcessingFormatProvider.Import(ms);

    using (Stream output = new FileStream(outputPath, FileMode.OpenOrCreate))
    {
        pdfProcessingFormatProvider.ExportSettings.IsEncrypted = true;
        pdfProcessingFormatProvider.ExportSettings.UserPassword = "pass";
        pdfProcessingFormatProvider.ExportSettings.ImageQuality = ImageQuality.Medium;
        pdfProcessingFormatProvider.Export(fixedDocument, output);
    }
}
 
0 comments