Open mahirekici opened 9 years ago
GreatReader doesn't support protected pdf. But you can unlock with CGPDFDocumentUnlockWithPassword.
Thanks.
(instancetype)initWithPath:(NSString *)path {
self = [super initWithPath:path]; if (self) { //burada şifrele
NSURL *URL = [NSURL fileURLWithPath:path];
_CGPDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)URL);
//PDFファイルがパスワード付きか調べる
BOOL isEncrypted = CGPDFDocumentIsEncrypted(_CGPDFDocument);
if(isEncrypted){
NSLog(@"isEncrypted YES");
}else{
NSLog(@"isEncrypted NO");
}
NSString *password = @"!XI5u2ri3Ar?.";
BOOL isUnlocked = CGPDFDocumentUnlockWithPassword(_CGPDFDocument, [password UTF8String]);
if(isUnlocked){
if (_CGPDFDocument) {
_numberOfPages = CGPDFDocumentGetNumberOfPages(_CGPDFDocument);
} else {
self.fileNotExist = YES;
return self;
}
_currentPage = 1;
_brightness = 1.0;
[self loadThumbnailImageAsync];
_kvoController = [FBKVOController controllerWithObserver:self];
}else{
NSLog(@"isUnlocked NO");
}
} return self; }
Hi, i have protected pdf. i want open , possible?