مستندات PDF الآمنة

Contents
[ ]

توفر Aspose.Cells for Python via .NET PdfSecurityOptions للعمل مع الأمان. يمكنك تعيين كلمات سر المالك والمستخدم أثناء الحفظ إلى صيغة PDF. سيتعين الرقم السري للمالك أو الرقم السري للمستخدم لفتح المستند المشفر بصيغة PDF للعرض.

  • يمكن أن تكون كلمة المرور للمستخدم فارغة أو سلسلة فارغة، في هذه الحالة لن يكون هناك حاجة إلى كلمة مرور من المستخدم عند فتح مستند PDF.
  • فتح مستند PDF بكلمة مرور المالك الصحيحة يسمح بالوصول الكامل (دون تحديد أي قيود وصول) إلى المستند.
  • فتح مستند PDF بكلمة مرور المستخدم الصحيحة (أو فتح مستند لا يحتوي على كلمة مرور للمستخدم) يسمح بوصول محدود حيث تم تحديد الأذونات.

يصف الكود النموذجي أدناه كيفية تأمين ملفات PDF باستخدام Aspose.Cells for Python via .NET.

from aspose.cells import PdfSaveOptions, Workbook
from aspose.cells.rendering.pdfsecurity import PdfSecurityOptions
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Open an Excel file
workbook = Workbook(dataDir + "input.xlsx")
# Instantiate PDFSaveOptions to manage security attributes
saveOption = PdfSaveOptions()
saveOption.security_options = PdfSecurityOptions()
# Set the user password
saveOption.security_options.user_password = "user"
# Set the owner password
saveOption.security_options.owner_password = "owner"
# Disable extracting content permission
saveOption.security_options.extract_content_permission = False
# Disable print permission
saveOption.security_options.print_permission = False
# Save the PDF document with encrypted settings
workbook.save(dataDir + "securepdf_test.out.pdf", saveOption)