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

DeHighLight / Remove HighLight

More
IP: 192.168.0.70 12 years 10 months ago #3124 by teradam
I have the same problem too.

I want to remove the highlight annotation when i tap it.
I think it is not working because of Page_getAnnotFromPoint( pdfPage, x, y ) might have a bug.
( when I use Page_getAnnot(index), it works well.)

Code:
- (void)OnSingleTapped:(float)x :(float)y { struct PDFV_POS pos; [m_view vGetPos:&pos]; PDFVPage *vPage = [m_view vGetPage:pos.pageno]; PDF_PAGE pdfPage = vPage.GetPage; NSLog(@"pdfPage:%@", [NSValue valueWithBytes:&pdfPage objCType:@encode(PDF_PAGE)]); // !!!: I can get pointer like "0x7b4cba0". PDF_ANNOT annot = Page_getAnnotFromPoint( pdfPage, x, y ); NSLog(@"annot:%@", [NSValue valueWithBytes:&annot objCType:@encode(PDF_ANNOT)]; // !!!: I cannot get pointer like "00000000" Page_removeAnnot(pdfPage, annot); annot = NULL; [m_view vRenderPage:pos.pageno]; / *** / }
More
IP: 192.168.0.70 12 years 10 months ago - 12 years 10 months ago #3125 by radaee
it's wrong, you should:
Code:
struct PDFV_POS pos; [m_view vGetPos:&pos]; PDFVPage *vPage = [m_view vGetPage:pos.pageno]; PDF_PAGE pdfPage = vPage.GetPage; PDF_ANNOT annot = Page_getAnnotFromPoint( pdfPage, pos.x, pos.y ); ...
and you'd better check vpage or pdfPage object is null.
Last edit: 12 years 10 months ago by .
More
IP: 192.168.0.70 12 years 10 months ago #3129 by teradam

radaee wrote: it's wrong, you should:

Code:
struct PDFV_POS pos; [m_view vGetPos:&pos]; PDFVPage *vPage = [m_view vGetPage:pos.pageno]; PDF_PAGE pdfPage = vPage.GetPage; PDF_ANNOT annot = Page_getAnnotFromPoint( pdfPage, pos.x, pos.y ); ...
and you'd better check vpage or pdfPage object is null.


Thanks!

I checked that vPage and pdfPage object is not null.
And I modified my code to match your suggestions, but it still doesn't work.
More
IP: 192.168.0.70 12 years 10 months ago #3131 by radaee
[m_view vGetPos:&pos, x, y];
More
IP: 192.168.0.70 12 years 10 months ago #3133 by teradam
Thanks!

I implemented below and my code works well! :lol:
Code:
PDFView.h -(void)vGetPos:(struct PDFV_POS *)pos x:(float)x y:(float)y; PDFView.m - (void)vGetPos:(struct PDFV_POS *)pos x:(float)x y:(float)y { [m_view vGetPos:pos :x :y ]; } RDPDFViewController.m -(void)OnSingleTapped:(float)x :(float)y { struct PDFV_POS pos; [m_view vGetPos:&pos x:x y:y]; PDFVPage *vPage = [m_view vGetPage:pos.pageno]; PDF_PAGE pdfPage = vPage.GetPage; PDF_ANNOT annot = Page_getAnnotFromPoint(pdfPage, pos.x, pos.y); Page_removeAnnot(pdfPage, annot); annot = NULL; [m_view vRenderPage:pos.pageno]; /** **/
Time to create page: 0.452 seconds
Powered by Kunena Forum