Produtos de Desktop :

Automação de Processos :

Desenvolvimento de Software:

 
Conversor de PDF para Word Clientes
 

Solid Framework - Amostra de Código

Este é um exemplo conciso para ajudar instalar e executar Solid Framework.Já foi testado com a Licença de Desenvolvedor Livre para Solid Framework utilizando diferentes versões do Visual Studio da Microsoft.

Protect PDF Files Using Passwords

From the SolidFramework.Pdf.PdfDocument object you can access the UserPassword and OwnerPassword string properties.

Protect PDF Files Using Passwords

Clique para executar o Vídeo/Tutorial

Steps for setting OwnerPassword and UserPassword

  1. Import the trial Developer License:


    License.Import(new StreamReader(@"C:\Users\Joe\license.xml"));

  2. Locate the PDF files using OpenFileDialog:


    OpenFileDialog OpFile = new OpenFileDialog();
    //show only PDF Files
    OpFile.Filter = "PDF Files (*.pdf)|*.pdf";

    if (OpFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
    ...

  3. Create a new PDFDocument object:


    PdfDocument document = new PdfDocument();

  4. Add the file the user selected to the new PDFDocument:


    document.Path = OpFile.FileName;

  5. Create a new Security Handler object and Assign the Password string values:


    //Note: Inorder to set passwords an Encryption Algorithm must be set
     PdfPasswordSecurityHandler securityHandler = new PdfPasswordSecurityHandler();
     securityHandler.OpenPassword = "user";
     securityHandler.OwnerPassword = "owner";
    ...

  6. Assign an encryption algorithm :


    //Note: In order to set the an encryption algorithm, passwords must be set on the document
    securityHandler.EncryptionAlgorithm = EncryptionAlgorithm.Aes256BitsX;
    ...

  7. Write the changes back into the document.:


    document.SaveProtected(securityHandler, OverwriteMode.ForceOverwrite);
    ...

 


Mapa do site
©2000-2017 Solid Documents Limited - Todos os direitos reservados.