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

TOPIC:

Annotation at point 9 years 11 months ago #6236

  • Rossi
  • Rossi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 49
  • Thank you received: 0
Hi, i tried to get annotation from touched point. I use the function annotAtPoint but this return the annotation rarely right.
This is my code on touchend
if ([[m_page GetPage] annotCount]) {
NSLog(@"%d",[[m_page GetPage] annotCount]);
Page_objsStart(&m_page);
PDF_RECT rect;
[[[m_page GetPage] annotAtPoint:point.x* m_scale :point.y* m_scale] getRect:&rect];
NSLog(@"%@ ",[[m_page GetPage] annotAtPoint:point.x* m_scale :point.y* m_scale]);
NSLog(@"%d ",[[[m_page GetPage] annotAtPoint:point.x* m_scale :point.y* m_scale] type]);
NSLog(@"fill color %d ",[[[m_page GetPage] annotAtPoint:point.x* m_scale :point.y* m_scale] getFillColor]);
NSLog(@"stroke color %d ",[[[m_page GetPage] annotAtPoint:point.x* m_scale :point.y* m_scale] getStrokeColor]);
NSLog(@"stroke width %f ",[[[m_page GetPage] annotAtPoint:point.x* m_scale :point.y* m_scale] getStrokeWidth]);
NSLog(@"rect %f",rect.top);

this return a value of annotation property only when i click in a part of the annotation and only for same annotation

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

Last edit: by Abdikayrov.

Annotation at point 9 years 11 months ago #6238

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
do not pass clicked point to annotFromPoint directly.
use like this:
PDFV_POS pos;
[m_view vGetPos:&pos : point.x * m_scale :point.y * m_scale];
if( pos.pageno >= 0 )
{
PDFVPage *vpage = [m_view vGetPage:pos.pageno];
if( !vpage )//shall not happen
{
return;
}
PDFPage *page = [vpage GetPage];
if( !page ) return;
m_annot = [page annotAtPoint:pos.x: pos.y];
if( m_annot )
{
//todo:
}
}
The following user(s) said Thank You: Abdikayrov

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

Last edit: by .
  • Page:
  • 1
Powered by Kunena Forum