Risposta alle domande più comuni

Caching highlights outside of PDF file
Ultimo aggiornamento 11 mesi fa

This article shows how to cache highlight outside the pdf, without changing the pdf structure.

You need a DB to save the highlighted page and coordinates, then you have to re-create the highlight when you re-open the pdf.

To calculate the first (m_index1) and last (m_index2) character index of the highlighted text :

float pt[] = new float[2];
pt[0] = m_annot_pos.x;
pt[1] =  m_annot_pos.y;
m_index1 = m_page.ObjsGetCharIndex(pt);
pt[0] = m_annot_page.ToPDFX(event.getX(), m_layout.vGetX());
pt[1] = m_annot_page.ToPDFY(event.getY(), m_layout.vGetY());
m_index2 = m_page.ObjsGetCharIndex(pt);

You should look at PDFLayoutView.onTouchSelect to better understand how it works.

To re-create the highlight you should use:

m_page.AddAnnotMarkup(m_index1, m_index2, type);


Caricamento in corso ...