This article shows you how to add an Edit Text annotation to a pdf (note: this method is assumed to be added in PDFLayoutView).
public void addTextBox(float x, float y){
float[] rect = new float[4];
rect[0] = x;
rect[1] = y;
rect[2] = x + 300;
rect[3] = y + 50;
VPage vpage = m_layout.vGetPage(m_pageno);
if( vpage == null ) return;
Page page = m_doc.GetPage(vpage.GetPageNo());
if (page == null ) return;
Matrix mat = vpage.CreateInvertMatrix(m_layout.vGetX(), m_layout.vGetY());
mat.TransformRect(rect);
page.AddAnnotEditbox(rect, Color.TRANSPARENT, 0, Color.WHITE, 13, Color.BLACK);
Page.Annotation newAnnot = page.GetAnnot(page.GetAnnotCount() - 1);
newAnnot.SetEditText("Example Text");
m_layout.vRenderSync(vpage);
invalidate();
//m_doc.Save();
}
AddTextBox method will add an Edit Text to a specific point:
- rect[2] is the width
- rect[3] is the height
You can edit these parameters as you want.
RadaeePDF SDK for Android
Created : 2016-02-08 11:51:52, Last Modified : 2017-07-05 14:23:31