Aspose.Cells.Examples.CSharp.Articles.SecurePDFDocuments.Run C# (CSharp) Méthode

Run() public static méthode

public static Run ( ) : void
Résultat void
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            // Open an Excel file
            Workbook workbook = new Workbook(dataDir+ "input.xlsx");

            // Instantiate PDFSaveOptions to manage security attributes
            PdfSaveOptions saveOption = new PdfSaveOptions();

            saveOption.SecurityOptions = new Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions();
            // Set the user password
            saveOption.SecurityOptions.UserPassword = "user";

            // Set the owner password
            saveOption.SecurityOptions.OwnerPassword = "owner";

            // Disable extracting content permission
            saveOption.SecurityOptions.ExtractContentPermission = false;

            // Disable print permission
            saveOption.SecurityOptions.PrintPermission = false;

            // Save the PDF document with encrypted settings
            workbook.Save(dataDir+ "securepdf_test.out.pdf", saveOption);
            // ExEnd:1
        }
    }
SecurePDFDocuments