PDF Dokumente sichern

Contents
[ ]

Aspose.Cells APIs bieten diePdfSicherheitsoptionenKlasse für die Arbeit mit der Sicherheit des Dateiformats PDF. Der folgende Beispielcode beschreibt, wie gesicherte PDF-Dateien mit Aspose.Cells for Java API erstellt werden.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(SecurePDFDocuments.class);
// Open an Excel file
Workbook workbook = new Workbook(dataDir + "input.xlsx");
// Instantiate PDFSaveOptions to manage security attributes
PdfSaveOptions saveOption = new PdfSaveOptions();
saveOption.setSecurityOptions(new PdfSecurityOptions());
// Set the user password
saveOption.getSecurityOptions().setUserPassword("user");
// Set the owner password
saveOption.getSecurityOptions().setOwnerPassword("owner");
// Disable extracting content permission
saveOption.getSecurityOptions().setExtractContentPermission(false);
// Disable print permission
saveOption.getSecurityOptions().setPrintPermission(false);
// Save the PDF document with encrypted settings
workbook.save(dataDir + "securepdf_test.pdf", saveOption);