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

Free Support Forum - aspose.com

Deleting text from PDF - TextReplaceOptions.ReplaceAdjustment.None not working


I have got trouble deleting text from pdf document.
This is problematic file: Plik.pdf (824.4 KB)
This file contain dwo annotations. When I deleted annotation text (and annotation), the remaining text in line has shifted. (TextReplaceOptions.ReplaceAdjustment = NONE).

This is sample code how I deleting text:

        // textFragmentsAsRectangles from annotation
        for (int i = textFragmentsAsRectangles.Count - 1; i >= 0; i--)
            var rectangle = textFragmentsAsRectangles[i];

            TextSearchOptions textOptions = new TextSearchOptions(rectangle, false);
            TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(phrase: null, textOptions);
            textFragmentAbsorber.TextReplaceOptions.ReplaceAdjustmentAction = TextReplaceOptions.ReplaceAdjustment.None;


            foreach (var textFragment in textFragmentAbsorber.TextFragments)
                // The property (textFragment.Text) contains good text (highlighted in document)
                textFragment.Text = string.Empty;

Summary: in sample document “TextReplaceOptions.ReplaceAdjustment.None” option not working for all text in document (There are place where this option works well).


Can you please share the code snippet that we can run without any error in our environment to replicate the same issue you are facing? You can simply share a minimal code snippet to reproduce the scenario so that we can test the scenario and address it accordingly.


AsposeTest.zip (115.5 KB)


We were able to replicate the similar issue in our environment by using Aspose.PDF for .NET 21.8. Therefore, we have logged it as PDFNET-50513 in our issue tracking system. We will further investigate the issue and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi there, we are having a very similar issue to this with the Aspose PDF library and have tried the most recent build (22.3.)

We have customers who are looking for this functionality and would like to know where this might be in the bug fix pipeline. We would consider going down the paid support route if that would resolve the issue more quickly.

Please advise.


Sometimes, issues are related to specific PDF document and are resolved only for that particular document. Can you please share any sample PDF document from your side along with the code snippet that you are trying and facing an issue? We will separately log a ticket for your case and share the ID with you. And sure, using the paid support option will definitely expedite the issue investigation and resolution process and you will receive updates quickly.

Apologies for the delay, I have a zip file containing all the relevant information, how shall i get this to you?


You can use the upload button in the post editor to upload the files with your post. In case the upload size is larger, you can upload it to Google Drive or Dropbox and share the link with us.

please see the link to the zip file as below:


We were not able to download the file from the link. It was not accessible. Can you please upload it to the Google Drive or Dropbox and share the links with us?

I have moved the file to my google drive. Link below:


While accessing the files from this link, we received another error i.e. AccessError.png (8.5 KB)

I cannot see this error as it is telling me the image is private and only accessible by the topic owner. I have tried to create a dropbox link. hopefully you can access this time.

thanks for sharing , this helps me so much.


Thanks for sharing the downloadable link. We have downloaded the project and have created another ticket as PDFNET-51778 in our issue management system. We will investigate this case and as soon as investigation is complete, we will let you know about updates in this forum thread. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Asad, I just wanted to follow up on this. As I mentioned before, we have been given provisional authorisation to go down the paid support route for this issue. If this would help to expedite the resolution please let me know?


We have already recorded your concerns and the ticket is under the investigation phase at the moment. We will surely inform you about the resolution time (in case of paid support) as soon as the investigation is complete. Please spare us little time.

Hi Asad, thanks for your reply - the reason I was following up is because I received an email from Aspose support, offering tips to get started. I was concerned that my original comment and concerns were not picked up but you have now confirmed that this is not the case.

I look forward to hearing from you.

kind regards,



Sure, we will inform you once we have some updates.