【问题标题】:secure pdf : locked/uneditable to prevent changes after generating from iOS device安全 pdf:锁定/不可编辑以防止从 iOS 设备生成后发生更改
【发布时间】:2012-05-04 10:19:01
【问题描述】:

我正在使用 UIKit 框架在 iOS 设备中生成 pdf。 我想知道我们是否可以锁定(提供安全性)生成的 pdf,以便在通过电子邮件发送或下载后,无法使用任何 pdf 可编辑工具进行编辑/修改。

【问题讨论】:

    标签: iphone objective-c xcode security pdf-generation


    【解决方案1】:

    是的 - 这是可能的。如果您开始使用 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  );
    

    【讨论】:

      猜你喜欢
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-09
      • 2018-08-12
      相关资源
      最近更新 更多