Save to PDF formatting and alignment issue

@Abdul_Salam Thank you for additional information. I have checked with the provided code and the output produced on my side is still looks correct:

Document doc = new Document("C:\\Temp\\source.docx");
FindReplaceOptions options = new FindReplaceOptions();
doc.getRange().replace("[NAME]", "James Bond", new FindReplaceOptions());
doc.save("C:\\Temp\\out.docx");

out.docx (18.6 KB)

I have tested with the latest 22.12 version of Aspose.Words for Java.

Thanks for your quick reply . Here providing additional information.
We are getting document data as base 64 then adding using Documnet construtor.

byte[] scanBytes = Base64.getDecoder().decode(request.getBase64str());
InputStream myInputStream = new ByteArrayInputStream(scanBytes); 
Document doc =new Document(myInputStream);

Attaching my base 64 data.
base64.zip (19.3 KB)

@Abdul_Salam Thank you for additional information. I have tested with your base64 string and the output still looks correct:

String base64Str =  readStream(new FileInputStream("C:\\Temp\\base64.txt"));
byte[] scanBytes = Base64.getDecoder().decode(base64Str);
InputStream myInputStream = new ByteArrayInputStream(scanBytes);
Document doc =new Document(myInputStream);
FindReplaceOptions options = new FindReplaceOptions();
doc.getRange().replace("[NAME]", "James Bond", new FindReplaceOptions());
doc.save("C:\\Temp\\out.docx");