2014-01-17 69 views

回答

1

是的,這裏是採用一個PDF,並使用256位AES加密加密它的一個副本很短的例子:

var openDialog = new OpenFileDialog(); 
openDialog.DefaultExt = "pdf"; 
if (openDialog.ShowDialog() == true) 
{ 
    using (var input = openDialog.OpenFile()) 
    { 
     var saveDialog = new SaveFileDialog(); 
     saveDialog.DefaultExt = "pdf"; 
     if (saveDialog.ShowDialog() == true) 
     { 
      using (var reader = new PdfReader(input)) 
      { 
       using (var output = saveDialog.OpenFile()) 
       { 
        PdfEncryptor.Encrypt(\ 
         reader, output, 
         PdfWriter.ENCRYPTION_AES_256, 
         "password", "password", 
         PdfWriter.ALLOW_PRINTING); 
       } 
      } 
     } 

    } 
} 
+0

可以iTextSharp的然後打開加密的文件後來呢?嘗試打開帶有256位加密的PDF時,我在v5.5.9中收到錯誤「未知加密類型R = 6」。 – Tim