open encrypted PDF - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC: open encrypted PDF

open encrypted PDF 6 years 4 months ago #3147

  • truculent
  • truculent's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 64
  • Thank you received: 0
hi
i know i must use this method :

int result = [m_pdf PDFOpen:pdfFullPath :@"xxxxxxxx"];
if(result == 1)
{
UINavigationController *nav = self.navigationController;
m_pdf.hidesBottomBarWhenPushed = YES;
m_pdf.navigationItem.title = @"Viewer";

[nav pushViewController:m_pdf animated:YES];
int pageno =1;
// [m_pdf initbar:pageno];
[m_pdf PDFThumbNailinit:pageno];
}
//return value is encryption document
else if(result == 2)
{
[pwdDlg show];
}
it going to [pwdDlg show]; but when enter password of pdf nothing happen :(

i debug it & see when it going to it i see :

-(int)PDFOpen:(NSString *)path : (NSString *)pwd
{

[self PDFClose];
const char *cpath = [path UTF8String];
PDF_ERR err = 0;
const char * password = [pwd UTF8String];
m_doc = Document_open(cpath, password, &err);

if( m_doc == NULL )
{
switch( err )
{
case err_password:
return 2;
break;
default: return 0;
}
}

it going to return 2 and alert show up but when enter password any thing happen :(

Please Log in or Create an account to join the conversation.

open encrypted PDF 6 years 4 months ago #3148

  • stronglee
  • stronglee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 93
  • Karma: 1
  • Thank you received: 2
Hi,

Maybe you need this function to check the password is right or wrong and open pdffile again.

- (void)alertView:(UIAlertView *)pwdDlg clickedButtonAtIndex:(NSInteger)buttonIndex
{
int result;
if(buttonIndex == 0)
{

NSString *pwd = text;
result = [m_pdf PDFOpen:pdfFullPath :pwd];
if(result == 1)
{
UINavigationController *nav = self.navigationController;
m_pdf.hidesBottomBarWhenPushed = YES;
nav.hidesBottomBarWhenPushed =NO;
[nav pushViewController:m_pdf animated:YES];
}
else if(result == 2)
{
NSString *str1=NSLocalizedString(@"Alert", @"Localizable",nil);
NSString *str2=NSLocalizedString(@"Error PassWord", @"Localizable",nil);
NSString *str3=NSLocalizedString(@"OK", @"Localizable",nil);
UIAlertView *alter = [[UIAlertView alloc]initWithTitle:str1 message:str2 delegate:nil cancelButtonTitle:str3 otherButtonTitles:nil,nil];
[alter show];
}
}

}

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum