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

delete highlight via tableview delete button

More
IP: 192.168.0.71 11 years 3 months ago #8219 by t.revor
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.
More
IP: 192.168.0.124 11 years 3 months ago #8230 by emanuele
Hi,

can you show us the code that are you using to delete the annot?
More
IP: 192.168.0.71 11 years 3 months ago - 11 years 3 months ago #8232 by t.revor
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];
}
Last edit: 11 years 3 months ago by .
More
IP: 192.168.0.124 11 years 3 months ago #8236 by emanuele
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.
More
IP: 192.168.0.71 11 years 3 months ago #8238 by t.revor
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.
More
IP: 192.168.0.124 11 years 3 months ago #8239 by emanuele
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
Time to create page: 0.499 seconds
Powered by Kunena Forum