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

Free Support Forum - aspose.com

Fine grained text manipulation support

Hello,

I would like to be able to replace a specific instance of string with another string, e.g.I have a PDF file with text contains several 'source word' and I want to replace only one of the 'source word' with 'dest word'

The text replace method replaces all instances of the source string with the destination string, while I want to be able to specify which source string I want to replace, and which one stays intact.

Searching through old posts - it was impossible. Did you add this feature since?

Thanks,

Shay

Hi Shay,

I’m afraid, currently Aspose.Pdf.Kit allows you to replace all the matching strings. However, please share your idea that how would you like the criteria to be specified. I mean, would it be like the string at some particular index in a particular page etc? Please share your idea with us and we’ll try to provide the support for this feature in our future versions.

We’re sorry for the inconvenience.
Regards,

Hi Latif,

What I would like to see is the ability to iterate over all document text "Nodes" and be able to setText and getText over all those Nodes. - similar to what I am currently doing with your MS-Office tools chain

- Shay

Hi Shay,

Please clarify one thing. What do you exactly mean by text nodes? You mean to iterate though a list of all the matching strings? Can you please share a sample file and elaborate your question with the example?

We’re looking forward to help you out.
Regards,

I would prefer to get similar interface to what I have in Aspose.Words:

To be able to get the pdf item equivalent of paragraph (or even better, text with the same style) and be able to perform setText(.) and getText(.) on this item .

The replace text interface is somewhat limited and has only single usage scenario in mind (e.g. replace %PLACE_HOLDER% with its value)

Having replaceText(.) augmented with some attribute on which instances to replace is not the clean way to add this functionality

Thanks,

Shay

Hi Shay,

I have logged this requirement as PDFKITJAVA-12074 in our issue tracking system. Our team will investigate further whether we can support this feature and try to implement it. We’ll update you via this forum once the feature is available.

We’re sorry for the inconvenience.
Regards,