Problem with ReplaceText function

Hi,
I am using the function replaceText() for a PDF document. The PDF contains the word “test”. I tried to replace the string “test” with the word “replaced” but it didn’t work. However, searching for “replaced” highlights the word “text”.

I used the following code. Please help me or provide more clarification. I need change a word inside a PDF file. What is the best way to do it using Aspose?

package samples.contentEditor;

import com.aspose.pdf.kit.*;

public class ReplaceText {

    public ReplaceText() {
        // Constructor
    }

    public static void main(String args[]) throws Exception {
        try {
            PdfContentEditor editor = new PdfContentEditor();
            editor.bindPdf("C:\\Documents and Settings\\Ever\\Desktop\\abc\\Scan-Family Wealth-18AUG_searchable_searchable.pdf");
            editor.replaceText("test", "replaced");
            editor.save("C:\\Documents and Settings\\Ever\\Desktop\\abc\\Scan-Family Wealth-18AUG_searchable_searchable.pdf");
        } catch (java.io.IOException ioe) {
            System.out.println(ioe.getMessage() + ioe.getStackTrace());
        }
    }
}

Hi Tony,

Thank you very much for considering Aspose.

Have you tried the latest version of Aspose.Pdf.Kit for Java? If so, please share the problematic PDF with us, so we could test the issue at our end. I would like to add that sometimes the issue is caused due to the particular contents or origin of the PDF file. We’ll look into the issue and provide you the resolution.

We’re sorry for the inconvenience.
Regards,