在IOS中设置PDF文件的密码

时间:2014-01-09 09:27:06

标签: ios pdf pdf-generation

如何在生成时为PDF文件设置密码所以用户在从电子邮件下载后用密码打开文件?任何帮助都会被appriecaited.thanks提前

1 个答案:

答案 0 :(得分:1)

CFDictionarySetValue(myDictionary, kCGPDFContextTitle, CFSTR("My PDF File"));
CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("My Name"));
///
CFDictionarySetValue(myDictionary, kCGPDFContextUserPassword, CFSTR("userpassword"));
CFDictionarySetValue(myDictionary, kCGPDFContextOwnerPassword, CFSTR("ownerpassword"));
///
pdfContext = CGPDFContextCreateWithURL (url, &pageRect, myDictionary); 

选中此Creating Password Protected PDF in Objective-C