Great minds help needed in text replacement pdf

I am using PDFNET sdk.

I did not find a solution or a way to replacement a word in the pdf page. I tried so many ways by taking help of

elementbuilder and element edit examples

Please help me in text replacement the below is my function

Simple plain text replacement.

private void ReplaceSelectedWord()

{

PDFDoc doc = new PDFDoc(input_path);

doc.InitSecurityHandler();

Page page = doc.GetPage(40);

string strWord;

Element element = null;

ElementReader reader = new ElementReader();

ElementWriter writer = new ElementWriter();

ElementBuilder builder = new ElementBuilder();

Element rect;

reader.Begin(page);

writer.Begin(page);

builder.Reset();

writer.Begin(page, ElementWriter.WriteMode.e_replacement);

Rect word_bbox = new Rect();

while ((element = reader.Next()) != null)

{

if (element.GetType() == Element.Type.e_text)

{

strWord = element.GetTextString();

// now compare the text withthe given word

if ((String.Compare(strWord, “Apple”, StringComparison.OrdinalIgnoreCase) == 0))

{

// string data = “Apply”;

ByteData = encoding.GetBytes(“Apply”);

element.GetBBox(word_bbox);

element.SetTextData(byteArr,4);

// please help me to fill the gap so that it replaces apple with APPLY

writer.WriteElement(element);

}

}

}

writer.End();

reader.End();

writer.Dispose();

reader.Dispose();

doc.Save(output_path + “Test1.pdf”, SDFDoc.SaveOptions.e_remove_unused);

doc.Close();

}

Confidentiality Notice:  This transmittal is a confidential communication.  If you are not the intended recipient, you are hereby notified that you have received this transmittal in error and that any review, dissemination, distribution or copying of this transmittal is strictly prohibited.  If you have received this communication in error, please notify this office immediately by reply and immediately delete this message and all of its attachments, if any.