Paragraph getting extended when converting from word to pdf

Hi Team,

We are converting a word file to pdf where in first page in word a paragraph is of 5 lines gets converted into 6 lines This causes formatting issue in final pdf.
Paragraph in word file -

Paragraph in pdf -

Sample document -
rde30213096.docx (1.0 MB)

Thanks

@forasposeissues Most likely the problem on your side occurs because the fonts used in your input document are not available on the machine where document is processed. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted. This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

The following fonts used in your document are not available on my side:

  • ‘Citi Sans Text’
  • ‘Citi Serif Display’
  • ‘Citi Sans Condensed’
  • ‘MS Shell Dlg 2’

Hi,

Custom Fonts.zip (857.4 KB)

Please try with these missing custom fonts.
Thanks

@forasposeissues Thank you for additional information. unfortunately, I cannot reproduce the problem after using the provided fonts. I have used the following simple code for testing:

Document doc = new Document(@"C:\Temp\in.docx");
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource(@"C:\Temp\fonts", true) });
doc.Save(@"C:\Temp\out.pdf");

Here is the output PDF produced on my side: out.pdf (1.4 MB)

Hi,

As we can see in out.pdf you sent the second paragraph has 6 lines.

But in word document which I sent the paragraph is of 5 lines.

@forasposeissues Could you please save the document as PDF using MS Word on your side and attach it here for our reference? The difference can be caused by different fonts available on machine where the document is viewed in MS Word and on the machine where the document is converted to PDF using Aspose.Words.

rde30213096.pdf (4.5 MB)

Yes, When the document when saved on MS Word as pdf we do not see the issue as you can see in attached pdf. But when converting using Aspose library from word to pdf we see the paragraph size increasing.

@forasposeissues In the attached document CitiSans font is not used. So it looks like the font is not available on the machine where you convert document to PDF using MS Word. MS Word substituted this font and that is why the rendering result is different: