是否有任何人有一個想法,如何在iphone SDK中實現密碼保護的PDF文件。我的意思是我需要從我的應用程序中創建一個密碼pdf文件。請幫助我。如何在iPhone SDK中實現密碼保護的PDF文件
任何人的幫助將不勝感激。
是否有任何人有一個想法,如何在iphone SDK中實現密碼保護的PDF文件。我的意思是我需要從我的應用程序中創建一個密碼pdf文件。請幫助我。如何在iPhone SDK中實現密碼保護的PDF文件
任何人的幫助將不勝感激。
這裏是另一種解決方案,可能是你的目的更好:
CGPDFContextCreate需要一個可以將密碼作爲屬性之一傳遞的字典。
爲CGPDFContxtCreate你會在找到蘋果的參考文件的細節:
你會在蘋果的文檔在這裏找到密碼設置信息:
我們可以通過以下方式提供PDF文件的密碼:
NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"owner", kCGPDFContextOwnerPassword, @"user", kCGPDFContextUserPassword, kCFBooleanFalse, kCGPDFContextAllowsCopying, kCFBooleanFalse, kCGPDFContextAllowsPrinting, nil];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileName = [NSString stringWithFormat:@"%@/Documents/samplePDF.pdf", NSHomeDirectory()];
if (![fileManager fileExistsAtPath:fileName]) {
[fileManager createFileAtPath:fileName contents:nil attributes:nil];
}
// Create the PDF context using the default page size of 612 x 792.
UIGraphicsBeginPDFContextToFile(fileName, CGRectZero, dictionary);
當您在PC中提取zipfile(由zip庫ziparchive創建)時,發生了什麼事情要求輸入密碼? – 2013-08-14 10:07:39
通常是...取決於ZIP客戶端應用程序。在我的情況下,我使用應用程序本身來擴展存檔 – bsorrentino 2013-08-16 09:18:27