Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

open encrypted PDF

More
IP: 192.168.0.70 12 years 8 months ago #3147 by truculent
open encrypted PDF was created by truculent
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 :(
More
IP: 192.168.0.70 12 years 8 months ago #3148 by stronglee
Replied by stronglee on topic open encrypted PDF
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];
}
}

}
Time to create page: 0.394 seconds
Powered by Kunena Forum