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

TOPIC:

delete highlight via tableview delete button 9 years 3 months ago #8219

  • t.revor
  • t.revor's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
i have outline view class that shows a list of highlights in a table view, when i use the delete button in a cell to remove a highlight, it does so in the database where the highlight is stored, but the highlight does not get removed from the page. please assist.

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

delete highlight via tableview delete button 9 years 3 months ago #8230

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

can you show us the code that are you using to delete the annot?

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

delete highlight via tableview delete button 9 years 3 months ago #8232

  • t.revor
  • t.revor's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
in tableview " comit editing style "

the code is as follows

annot = (PDFAnnot *)[self.highlightsArray objectAtIndex:indexPath.row];

struct PDFV_POS pos;

[mview vGetPos:&pos :pos.x :pos.y];

PDFVPage *vPage = [mview vGetPage:pos.pageno];
PDF_PAGE pdfPage = (__bridge PDF_PAGE)(vPage.GetPage);

Page_removeAnnot(pdfPage, (__bridge PDF_ANNOT)(annot));


I also tried this one below:

PDF_ANNOT annotation = (__bridge PDF_ANNOT )[self.highlightsArray objectAtIndex:indexPath.row];
annotation = Page_getAnnotFromPoint(pdfPage, pos.x, pos.y);
if( pdfPage )
{
annot = [page annotAtPoint:pos.x :pos.y];
[annot type];
[annot removeFromPage];
annot = nil;
[mview vRenderSync:pos.pageno];
}

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

Last edit: by .

delete highlight via tableview delete button 9 years 3 months ago #8236

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
the usage of

struct PDFV_POS pos;

[mview vGetPos:&pos :pos.x :pos.y];

is wrong.

vGetPos set the PDFV_POS instance from the point x,y; you can't use pos.x, pos.y to get the current PDFV_POS (pos.x and pos.y are nil, so the method will return a nil PDFV_POS).

You should save into your database the page and the position of the annotation and use that information to get the PDFVPage and remove the annot.

In demo project you can see -(void)onSingleTap:(float)x :(float)y method in PDFView class, to get the annotation, and -(void)vAnnotRemove method to remove the annotation.
The following user(s) said Thank You:

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

delete highlight via tableview delete button 9 years 3 months ago #8238

  • t.revor
  • t.revor's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
thanks Emanuele.

I am saving annotations in database. when i click delete it does remove the annotation from the database, but does not remove from the pdf page.

here it is:

1. i have rdpdfviewcontroller - it is responsible for opening pdf and other stuff... vannotremove is working if i click the highlight text then click delete (like in the demo)

2. now i have another view (tableview controller) which after creating annotation using rdpviewcontroller (pdf), the annotation is shown in this table view.

3. now, when i click the table view cell to delete the annotation, it does so in data base, and the cell contents is also removed, BUT the annotation itself in pdf is still there.

can you help emanuele,, if you need further explanation, please let me know.

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

delete highlight via tableview delete button 9 years 3 months ago #8239

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
You should get the annotation with something like:

PDFVPage *vpage = [m_view vGetPage:pageNumber];
PDFPage *page = [vpage GetPage];

m_annot = [page annotAtPoint:annotX: annotY];

than remove the annotation with something like:
if( m_annot )
[m_annot removeFromPage];


pageNumber, annotX and annotY are values saved into your database

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum