Güvenli PDF Belgeleri

Contents
[ ]

Python için Aspose.Cells via .NET, güvenlikle çalışmak için PdfSecurityOptions sağlar. PDF’ye kaydederken sahibi ve kullanıcı şifrelerini ayarlayabilirsiniz. Şifreler PDF belgesini görüntülemek için gereklidir.

  • Kullanıcı şifresi null veya boş dize olabilir, bu durumda kullanıcıdan PDF belgesini açarken herhangi bir parola gerekli olmayacaktır.
  • Doğru sahip parolasıyla PDF belgesinin doğru şekilde açılması belgeye tam erişim (belirtilen herhangi bir erişim kısıtlaması olmadan) sağlar.
  • Doğru kullanıcı parolasıyla PDF belgesinin doğru şekilde açılması (veya herhangi bir kullanıcı parolası olmayan bir belgenin açılması) belirtilen izinlerle sınırlı erişim sağlar.

Aşağıdaki örnek kod, Aspose.Cells için Python via .NET ile PDF’leri nasıl güvence altına alacağınızı açıklar.

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)