Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Not Accurate of get Annotation 9 years 8 months ago #7038

  • ex93nball
  • ex93nball's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
  • Thank you received: 0
I got this code to get Annot from page, but its not accurate with coordinate.
sometimes i got annot with that x,y coordinate on page 1 but when i scroll a half to page 2 and touch the annot its not recognise an annotation on page 2 :(

- (void)OnSingleTapped:(float)x :(float)y :(NSString *)text{
struct PDFV_POS pos;
[m_view vGetPos:&pos];
PDFPage *page = [m_doc page:pos.pageno];

PDFAnnot *m_annot = [page annotAtPoint:x: y];
NSLog(@"tipe annot = %d, pageno = %d",m_annot.type,pos.pageno);
}

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

Not Accurate of get Annotation 9 years 8 months ago #7043

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
PDFPage *page = [m_doc page:pos.pageno];
[page objsStart];
//...

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

Not Accurate of get Annotation 9 years 8 months ago #7044

  • ex93nball
  • ex93nball's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
  • Thank you received: 0
I got this Error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PDFPage annotAtPoint:]: unrecognized selector sent to instance 0x7bac7b10'

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

Not Accurate of get Annotation 9 years 7 months ago #7177

  • Gracanin
  • Gracanin's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 25
  • Thank you received: 0
The following doesn't work, how do I select annotations that are already in the PDF
-(void)OnSingleTapped:(float)x :(float)y :(NSString *)text
{
struct PDFV_POS pos;
[m_view vGetPos:&pos];
PDFPage *page = [m_doc page:pos.pageno];
[page objsStart];
PDFAnnot *annot = [page annotAtPoint:x :y];
if(annot)
{
PDF_RECT rect;
[annot getRect:&rect];
NSLog(@"%f %f %f %f", rect.left, rect.top, rect.right, rect.bottom);
}
}

EDIT: It doesn't work in View Controller, but in PDFView.m it works fine.

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

Last edit: by tutChetsRoodo. Reason: Found soultion
  • Page:
  • 1
Powered by Kunena Forum