安全pdf:已锁定/不可编辑,以防止从iOS设备生成后进行更改 [英] secure pdf : locked/uneditable to prevent changes after generating from iOS device
本文介绍了安全pdf:已锁定/不可编辑,以防止从iOS设备生成后进行更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用UIKit Framework在iOS设备中生成pdf. 我想知道我们是否可以锁定(提供安全性)生成的pdf,以便在通过电子邮件发送或下载后无法使用任何pdf可编辑工具进行编辑/修改.
I am using UIKit Framework to generate pdf in iOS device. I am wondering if we can lock (provide security) to the generated pdf so that after emailing or downloading it , one can not edit/modify using any pdf editable tool.
推荐答案
是的-这是可能的.如果使用UIGraphicsBeginPDFContextToFile开始创建PDF,则可以向其发送带有选项的字典,以指定所需的加密/锁定类型.这是它的文档:
Yes - this is possible. If you start the creation of a PDF with UIGraphicsBeginPDFContextToFile you can then send a dictionary to it with options to specify what kind of encryption/locking you want. Here is the documentation for it:
这是创建它的示例:
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 );
这篇关于安全pdf:已锁定/不可编辑,以防止从iOS设备生成后进行更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文