我正在使用UIKit框架来生成iOS设备的pdf文件。我想知道我们是否可以锁定(提供安全)到生成的pdf,以便在电子邮件或下载后,一个人不能编辑/修改使用任何pdf可编辑的工具。
发布于 2012-07-30 06:25:12
是的,这是可能的。如果你开始用UIGraphicsBeginPDFContextToFile创建一个PDF,你可以发送一个字典给它,里面有指定你想要的加密/锁定类型的选项。下面是它的文档:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html
下面是一个创建它的示例:
NSDictionary * pdfInfo = nil;
if (trimmedPassPhrase && [trimmedPassPhrase length] > 0) {
pdfInfo = [NSDictionary dictionaryWithObjectsAndKeys:trimmedPassPhrase, kCGPDFContextOwnerPassword,
trimmedPassPhrase, kCGPDFContextUserPassword,
[NSNumber numberWithInt:128], kCGPDFContextEncryptionKeyLength, nil];
}
BOOL pdfContextSuccess = UIGraphicsBeginPDFContextToFile(newFilePath, CGRectZero, pdfInfo );https://stackoverflow.com/questions/10286732
复制相似问题