Similar to iOS 13 and Password Protected PDFs - #3 by amani7
When rendering a password protected excel workbook to PDF users on IOS13 are unable to view the pdf or in some cases can seem a clipped version of the pdf. This is consistently reproducible and when removing the password shows no issue. The issue is also non-existent on previous versions of IOS.
This is the code used to encrypt:
protected PdfSaveOptions AddEncryption(Workbook workbook, bool userLocked) {
var options = new PdfSaveOptions { };
var properties = workbook.Worksheets.CustomDocumentProperties;
if (properties.Contains("password")) {
var pass = properties["password"].ToString();
options.SecurityOptions = new Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions();
if (!string.IsNullOrWhiteSpace(pass)) {
if (userLocked) {
options.SecurityOptions.UserPassword = pass;
options.SecurityOptions.OwnerPassword = pass;
} else {
options.SecurityOptions.OwnerPassword = pass;
}
options.SecurityOptions.ExtractContentPermission = false;
options.SecurityOptions.PrintPermission = false;
}
}
return options;
}