如何在生成PDF文件时设置密码,以便用户从电子邮件下载后用密码打开文件?任何帮助都将得到感谢。
最佳答案
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