Editing a page with columns

Hello,
I’m trying to replace some text in a PDF document, in this case, a page with its text divided in two columns.

After replacing the old text, the formatting is messed up and the columns are gone.

Is there a way to edit text while keeping the same column format ?

@Liamk

Could you please share your sample PDF document along with sample code snippet. We will test the scenario in our environment and address it accordingly.

Thank you, here it is5.pdf (71.9 KB)

@Liamk

Please also share the code snippet that you have tried at your side to replace the text from this document so that we can test the scenario accordingly.

Here is the code I use :
public static void modif(Document doc, String search, String replace) {
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(search);
doc.getPages().accept(textFragmentAbsorber);
for (TextFragment textFragment : (Iterable) textFragmentAbsorber.getTextFragments()) {
textFragment.setText(replace);
TextFragmentState state = textFragment.getTextState();
textFragment.getTextState().setFont(state.getFont());
textFragment.getTextState().setFontSize(state.getFontSize());
textFragment.getTextState().setForegroundColor(state.getForegroundColor());
textFragment.getTextState().setBackgroundColor(Color.getWhite());
textFragmentAbsorber.getTextReplaceOptions().setReplaceAdjustmentAction(TextReplaceOptions.ReplaceAdjustment.WholeWordsHyphenation);
}
}
“search” is the string I want to replace and “replace” is its replacement.

I’m trying to replace “Majencia SA” with “Nowy Styl - Majencia”

Thank you for your help

@Liamk

We were able to replicate the issue in our environment with Aspose.PDF for Java 19.6. Therefore, we have logged it as PDFJAVA-38676 in our issue tracking system for the sake of correction. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.