We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Highlight exact phrase

hi is there the possibilities to highlight the exact word ?
for example i want to highlight this word “sif”
when i i have a word like “sifone” i don’t want to highlight part of word , i want to highlight only the exact word .

@francescoesposito,

You can use regular expression to find out the exact word, and then iterate through the text fragments and highlight them by creating the rectangle around each text fragment. Please refer to this help topic: Highlight each character in PDF document

I’m getting the following error when I try to highlight the attached pdf :
“startIndex cannot be larger than length of string. Parameter name: startIndex”
The keywords are: (?i)CULTCITY|(?i)EXPLORA|(?i)INLOMBARDIA|(?i)STRANAVIGLI|(?i)MARCHESIwwwbuongiornoonlineit20180328177EXPLORAWEB-1.pdf (590.3 KB)

@francescoesposito,

We have tested your scenario with the latest version 18.3 of Aspose.PDF for .NET API, and unable to replicate the said error in our environment. Kindly let us know which version of Aspose.PDF for .NET API you are using. If you have modified the code, then please send us the code. Your response is awaited.