Knowledge Base - Android - Auto resize free text annotation height

The default behavior of the free-text annotation (Type = 3) is that it has a fixed height regardless of its content.

If you need to resize the annotation height based on the content, you need to add the following code in onDismiss of m_pEdit.setOnDismissListener found in GLView.

Note: This is supported from version 3.53.5 (code is already included but commented in the demo project)

m_pEdit.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (m_annot != null) {
// auto resize free-text annotation
if(m_annot.GetType() == 3) {
float old_pdf_rect[] = m_annot.GetRect();
float new_height = m_pEdit.getContentHeight() / m_annot_page.GetScale();
float new_pdf_rect[] = new float[4];
new_pdf_rect[0] = old_pdf_rect[0];
new_pdf_rect[2] = old_pdf_rect[2];
new_pdf_rect[3] = old_pdf_rect[3];
new_pdf_rect[1] = new_pdf_rect[3] - new_height;
m_annot.SetRect(new_pdf_rect[0], new_pdf_rect[1], new_pdf_rect[2], new_pdf_rect[3]);
}

...
}
}
});
Applies To

RadaeePDF SDK for Android

Details

Created : 2020-07-16 15:03:58, Last Modified : 2020-07-17 14:16:31

Order history

Login to handle your order history.