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

Free Support Forum - aspose.com

Text shifting after replacement in landscape pdf

Hello, I ran into a problem when replacing text in landscape documents. When we make a replacement in a line that consists of several words, sometimes the part of the line that is to the right of the replacement moves down.

	void landscapeReplacement() throws IOException {
	var inputStream = new ClassPathResource("pdf/testLandscape.pdf").getInputStream();
	var document = new Document(inputStream);
	var page = document.getPages().get_Item(1);
	var absorber = new TextFragmentAbsorber();
	absorber.setTextSearchOptions(new TextSearchOptions(new Rectangle(258, 240, 285, 249), false));
	List<TextFragment> result = StreamSupport.stream(absorber.getTextFragments().spliterator(), true).collect(Collectors.toList());
	save(document, "TestAssembler.pdf");

testLandscape.pdf (606.3 KB)

see result.pdf.result.pdf (668.5 KB)

and result2.png , this is what the page looks like if you make a replacement in each line
result2.png (16.8 KB)

I really think that the problem is in the landscape pages, because I tried on several examples and this situation only occurs in them and only when the replacement is done for a multi-word line.

Is there any workaround for this or what can I do with it?



I was able to replicate the problem. I will be creating a ticket for the dev team.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-53929

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thanks, I forgot to mention that this issue was found in Aspose java, judging by the ticket name you created a bug for .Net.


I appreciate your response.

The application is built in .NET and then automatically ported to Java, with some changes done manually in Java.

So if a bug happens in the .NET version, it has to be corrected there, so it gets ported to Java, or it will be overwritten.

If it only happened in Java then we create a Java-exclusive ticket.

Again, thanks for taking the time to mention this.

1 Like