Hi,
I am getting below exception
java.lang.NullPointerException: Cannot invoke "com.aspose.pdf.internal.l21p.l19v.l0l()" because "<parameter1>" is null
at com.aspose.pdf.internal.l6n.lI.lI(Unknown Source)
at com.aspose.pdf.internal.l6n.lI.lI(Unknown Source)
at com.aspose.pdf.internal.l6n.lI.lI(Unknown Source)
at com.aspose.pdf.l19f.lI(Unknown Source)
at com.aspose.pdf.TextFragment.lb(Unknown Source)
at com.aspose.pdf.TextFragment.setText(Unknown Source)
at com.aspose.pdf.facades.PdfContentEditor.replaceText(Unknown Source)
at com.aspose.pdf.facades.PdfContentEditor.replaceText(Unknown Source)
at com.aspose.pdf.facades.PdfContentEditor.replaceText(Unknown Source)
Cod e-
try(PdfContentEditor editor = new PdfContentEditor()) {
//Creating object of ReplaceTextStrategy class, to set the text replacement condition
ReplaceTextStrategy replaceTextStrategy = new ReplaceTextStrategy();
//Enable and disable pattern searching
if(searchPattern) {
replaceTextStrategy.setRegularExpressionUsed(true);
}
//Adding parameter to replace all occurrence text
replaceTextStrategy.setReplaceScope(ReplaceTextStrategy.Scope.ReplaceAll);
editor.setReplaceTextStrategy(replaceTextStrategy);
//loading pdf document in PdfContentEditor class
editor.bindPdf(pdfDocument);
//Calling method to mask the text
editor.replaceText(textValue, Type);
}