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

Annot render problem on device

More
IP: 192.168.0.71 11 years 5 months ago #7233 by shivkant
Hi,

Facing a problem of annotation rendering on device. It works on simulator and even I get the total annotation count on simulator. But on device it does not add any annotation. Please help.

Thanks in advance.
More
IP: 192.168.0.71 11 years 5 months ago #7236 by radaee
do you mean add annotation?
plz check [m_doc CanSave];
More
IP: 192.168.0.71 11 years 5 months ago #7251 by shivkant
Yes on adding notation, When ever I run my app on simulator I able to add a notations like highlighter/Underline/StrikeOut, but when I run the app on device it does not add the notations. after adding notation it did not render notations and gives notation count 0 on particular page.

Even I downloaded demo code again and call PDFGlobal class method

bool isSuccess = Global_activePremium("PackageName", "Company name", "mail id", "license key");

with appropriate parameters(those I got after purchasing license key) it returns 1, that means my credentials are right. It works on simulator fine. and when I use same code on my device, annotation features not working.

Please help.
Thanks
More
IP: 192.168.0.71 11 years 5 months ago #7252 by shivkant
[m_doc CanSave]; returns 0, after activate with premium credentials.

Please help.
More
IP: 192.168.0.71 11 years 5 months ago #7253 by radaee
there are 3 condition:
1. PDFDoc object not init.
2. PDFDoc object not open or create, or closed.
3. the file opened is not writeable.
More
IP: 192.168.0.71 11 years 5 months ago #7257 by shivkant
PDFDoc object init methods calls in these methods

but when I call

[m_doc save]; returns 0 after calling m_doc = [[PDFDoc alloc] init];.

So I know this may be the problem. but how to resolve it

here are those method copied from demo code.

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

[self PDFClose];
PDF_ERR err = 0;
m_doc = [[PDFDoc alloc] init];
err = [m_doc open:path :pwd];

switch( err )
{
case err_ok:
break;
case err_password:
return 2;
break;
default: return 0;
}
CGRect rect = [[UIScreen mainScreen]bounds];

//GEAR
if (![self isPortrait] && rect.size.width < rect.size.height) {
float height = rect.size.height;
rect.size.height = rect.size.width;
rect.size.width = height;
}
//END
float hi = self.navigationController.navigationBar.bounds.size.height;
NSString *iosversion =[[UIDevice currentDevice]systemVersion];

if([iosversion integerValue]>=7)
{
m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height)];
}
else
{
m_view = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, rect.size.height-20-44)];
}
[m_view vOpen:m_doc: self];
pagecount =[m_doc pageCount];
[self.view addSubview:m_view];
m_bSel = false;
return 1;
}


-(void)vOpen:(PDFDoc *)doc :(id<PDFVDelegate>)delegate
{
//GEAR
[self vClose];
//END
m_doc = doc;
//g_PDF_ViewMode =2;
//defView =2;
bool *verts = (bool *)calloc( sizeof(bool), [doc pageCount] );
switch(defView)
{
case 1:
m_view = [[PDFVHorz alloc] init:false];
break;
case 2:
m_view = [[PDFVHorz alloc] init:true];
break;
case 3:
//for dual view
m_view = [[PDFVDual alloc] init:false :NULL :0 :NULL :0];
//for single view
//m_view = [[PDFVDual alloc] init:false :NULL :0 :verts :Document_getPageCount(doc)];
break;
case 4:
//for dual view
m_view = [[PDFVDual alloc] init:true :NULL :0 :NULL :0];
//for single view
//m_view = [[PDFVDual alloc] init:true :NULL :0 :verts :Document_getPageCount(doc)];
break;
default:
m_view = [[PDFVVert alloc] init];
break;
}
free( verts );
m_type = defView;
struct PDFVThreadBack tback;
tback.OnPageRendered = @selector(OnPageRendered:);
tback.OnFound = @selector(OnFound:);
self.backgroundColor = [UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:1.0f];
[m_view vOpen:doc :4 :self: &tback];
[m_view vResize:m_w :m_h];

m_timer = [NSTimer scheduledTimerWithTimeInterval:0.03
target:self selector:@selector(timerFireMethod:)
userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop]addTimer:m_timer forMode:NSDefaultRunLoopMode];
m_status = sta_none;
m_ink = NULL;
m_modified = false;

m_rects = NULL;
m_rects_cnt = 0;
m_rects_max = 0;

m_ellipse = NULL;
m_ellipse_cnt = 0;
m_ellipse_max = 0;

m_cur_page = -1;
m_delegate = delegate;
}

It is happing in currently downloaded demo code. annotation works on simulator but not on device.

Please help.
Time to create page: 0.424 seconds
Powered by Kunena Forum