@srinudhulipalla,
Regarding WORDSNET-22612, we have completed the analysis of this issue and concluded to close this issue with “not a bug” status. This is the problem of handling \n
characters in text. Aspose.Words replaces all \n
characters with EmSpace
, and the sequence \r\n
in the paragraph results in {paragraphinline}{emspace}
in Aspose.Words’ layout. This {emspace}
is at the start of the line and hence visually it appears as if lines were positioned to the right.
If document, before it is exported into PDF, is saved to DOCX and reloaded, then the problem goes away. This happens due to \r\n
exported as <w:cr>
which is then loaded as \r
.
We believe the problem here is with the code you are using i.e. there is misunderstanding of what \r\n
in the text would do in the document. Either builder needs to recognize the intent of the caller and replace the content appropriately or it should provide clear rules on how this is handled.
As a workaround you can re-save the document before PDF export (can be done using memory stream), or can replace \r\n
with \r
in replacement string.
e.Replacement = Regex.Replace(e.Replacement, @"\r\n?|\n", "\r");