您好:
我目前使用的各項Aspose.xxx for .NET 是18.11或是18.12 版的
需要將這四種類型格式的檔案轉為PDF,並加上密碼、禁止列印
呼叫的方式從文件中參考了此份文件:
目前遇到的問題條列如下:
-
各項產品的呼叫方式不同:
word的PDF儲存選項是:Aspose.Words.Saving.PdfSaveOptions
裡面有 PdfEncryptionDetails 的選項,可以加密、可以設定Permissions;
excel的PDF儲存選項是:Aspose.Cells.PdfSaveOptions,沒有包含PdfEncryptionDetails 的參數設定;
pdf的PDF儲存選項是:Aspose.Pdf.PdfSaveOptions,沒有包含PdfEncryptionDetails 的參數設定;
ppt甚至沒有PdfSaveOptions -
word的禁止列印無效
Aspose.Words.Saving.PdfSaveOptions saveOptions = new Aspose.Words.Saving.PdfSaveOptions();
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(password, string.Empty, PdfEncryptionAlgorithm.RC4_128);
encryptionDetails.Permissions = PdfPermissions.DisallowAll;
saveOptions.EncryptionDetails = encryptionDetails;
document.Save(pdfFilePath, saveOptions);
設定為DisallowAll,但是PDF打開還是看到允許列印。
(和我設定為PdfPermissions.Printing 時相同。)
先感謝您們的回覆,謝謝。