Text replacement WITHOUT automatic rearrange

I’m using the latest version and when I am replacing text, text on the same line get shifted over. Unfortunately, it breaks the formatting. Is there a version of the code from the link below that does NOT rearrange the page items?

I tried creating this topic yesterday, but when I click on the topic, it says “you do not have access to this topic”, so I am recreating it again.


Thanks for contacting support.

Would you please share your sample PDF document along with complete code snippet which you are using to replace the text. We will test the scenario in our environment and address it accordingly.

Would you please share the link of that topic. We will check it and share our feedback with you.

Case 1:

The following code will reproduce the issue. The : (colon) in :_WS_ will shift over.

pdfBoxTemplate = this.GetType().Assembly.GetManifestResourceStream("ScratchModule.Resources.READER_BOX_LABEL_TEMPLATE-V010-000.pdf");
MemoryStream outputLabel = new MemoryStream();
PdfFileMend pdfMend = new PdfFileMend(new Document(pdfBoxTemplate));
Document doc = pdfMend.Document;
string woVar = "_WO_";
string pnVar = "_PN_";
_partNumber =  "900NTNNEK0000"

PDFEditorHelpers.ReplaceText(pnVar, _partNumber, doc);
PDFEditorHelpers.ReplaceText(woVar, _wo, doc);

PDFEditorHelpers.ReplaceText(string input , string replace, Document doc) {
var textFragmentAbsorber = new TextFragmentAbsorber(input);
            textFragmentAbsorber.TextSearchOptions = new Aspose.Pdf.Text.TextSearchOptions(true);
            var textFragmentCollection = textFragmentAbsorber.TextFragments;
            if (textFragmentCollection.Count == 1)
                textFragmentCollection[1].Text = replace;

boxlabel.pdf (85.8 KB)

Original file: “READER_BOX_LABEL_TEMPLATE-V010-000.pdf”
Output File: boxlabel.pdfREADER_BOX_LABEL_TEMPLATE-V010-000.pdf (69.4 KB)

For some reason, the SSO session doesn’t properly sign out. Here is the original file, boxlabel.pdfboxlabel.pdf (85.8 KB)


Thanks for sharing further details.

We have tested the scenario in our environment while using your code snippet with Aspose.PDF for .NET 18.5 and were able to notice the issue. Hence, we have logged this issue as PDFNET-44842 in our issue tracking system for the sake of further investigation.

However, we have also observed that after changing the replacement words sequence, the API generated correct output.

READER_BOX_LABEL_TEMPLATE-V010-000.replaced.pdf (85.8 KB)

ReplaceText(woVar, _wo, doc);
ReplaceText(pnVar, _partNumber, doc);

instead of:

We will further investigate this behavior of the API and keep you informed with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

Unfortunately, this workaround will not work for us. This PDF is one of several “templates” we work with. It is unfortunate the the “Automatically arrange” functionality is enabled by default with no way to disable it…We would prefer the Library NOT try to automatically arrange any elements on its own.


We have recorded your concerns and will definitely consider them while investigating the issue. As soon as we have some definite updates regarding resolution of the logged issue, we will surely let you know. Please spare us little time.

We are sorry for the inconvenience.

Is there any update on this issue? It seems rather odd that there is no way to tell the API not to automatically rearrange the elements. Plus we have paid for a license and this is holding up our new release.


Thanks for your inquiry.

Please note that the issue has recently been logged in our issue tracking system and pending for investigation. Furthermore, it has been logged under free support model, hence will be investigated on first come first serve basis. We do realize the severity of the issue, but there are other pending issues as well which were logged prior to your issue and need to be resolved.

Moreover, we also offer paid support model to our customers, where issues have high priority and are resolved on urgent basis. You may please check our paid support forum for more information. As soon as we make some significant progress towards resolution of the logged issue, we will surely inform you. Please spare us little time.

We are sorry for the inconvenience.

This is quite disappointing. We’ve just purchased the license end of march and the system doesn’t behave properly. How to get access to the paid support ? This is blocking and critical.


Thanks for writing to us.

We really apologize for the inconvenience you are facing. Please note that we do understand the severity of the issue and will definitely consider it while investigating it. However, if the issue is blocker and you want to escalate things by subscribing to paid support, you may please contact our sale team or post your query in Aspose.Purchase category. You will definitely be assisted accordingly.

We are sorry for this inconvenience.


We have performed an initial investigation on the logged issue and found the actual cause. Since, the issue priority is low, I am afraid that we cannot make any promises regarding its resolution any sooner, because there are other high priority issues in the queue. However, the issue can be fixed during month if you raise its priority through high priority support channel.

The issues you have found earlier (filed as PDFNET-44842) have been fixed in Aspose.PDF for .NET 18.9.