原創|其它|編輯:郝浩|2012-09-10 15:40:09.000|閱讀 1501 次
概述:為了保證文件的安全性,我們通常都希望對自己的PDF文件進行加密,所以,文件加密功能是非常實用的。下面,慧都控件網就和大家一起來分享執行PDF文件加密操作的事例代碼,供大家參考:
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
為了保證文件的安全性,我們通常都希望對自己的PDF文件進行加密,所以,文件加密功能是非常實用的。下面,慧都控件網就和大家一起來分享Aspose.Cells執行PDF文件加密操作的事例代碼,供大家參考:
[C#]
//Open an Excel file
Workbook workbook = new Workbook("e:\\test\\book1.xls");
//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("e:\\test\\securepdf_test.pdf", saveOption);
[VB]
'Open an Excel file
Dim workbook As New Workbook("e:\test\book1.xls")
'Instantiate PDFSaveOptions to manage security attributes
Dim saveOption As 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("e:\test\securepdf_test.pdf", saveOption)
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網