- Posts: 4
- Thank you received: 0
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
IP: 192.168.0.70
12 years 10 months ago #3124
by teradam
Replied by teradam on topic DeHighLight / Remove HighLight
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.)
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];
/ *** /
}
IP: 192.168.0.70
12 years 10 months ago - 12 years 10 months ago #3125
by radaee
Replied by radaee on topic DeHighLight / Remove HighLight
it's wrong, you should:
and you'd better check vpage or pdfPage object is null.
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 );
...
Last edit: 12 years 10 months ago by .
IP: 192.168.0.70
12 years 10 months ago #3129
by teradam
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.
Replied by teradam on topic DeHighLight / Remove HighLight
radaee wrote: it's wrong, you should:
and you'd better check vpage or pdfPage object is null.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 ); ...
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.
IP: 192.168.0.70
12 years 10 months ago #3131
by radaee
Replied by radaee on topic DeHighLight / Remove HighLight
[m_view vGetPos:&pos, x, y];
IP: 192.168.0.70
12 years 10 months ago #3133
by teradam
Replied by teradam on topic DeHighLight / Remove HighLight
Thanks!
I implemented below and my code works well! :lol:
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