DeHighLight / Remove HighLight - Page 2 - RadaeePDF.com - Results from #6
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1
  • 2

TOPIC:

DeHighLight / Remove HighLight 7 years 2 months ago #3124

  • teradam
  • teradam's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
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.)

- (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];
	
	/ *** /
}
	

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

DeHighLight / Remove HighLight 7 years 2 months ago #3125

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1002
  • Karma: 43
  • Thank you received: 49
it's wrong, you should:
	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.

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

Last edit: by .

DeHighLight / Remove HighLight 7 years 2 months ago #3129

  • teradam
  • teradam's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0

radaee wrote: it's wrong, you should:

	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.

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

DeHighLight / Remove HighLight 7 years 2 months ago #3131

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1002
  • Karma: 43
  • Thank you received: 49
[m_view vGetPos:&pos, x, y];

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

DeHighLight / Remove HighLight 7 years 2 months ago #3133

  • teradam
  • teradam's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Thanks!

I implemented below and my code works well! :lol:
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];

	/** **/

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum