Different FontSize in the Word to PDF conversion

Hi,

When I convert the Adventure Works.docx file to PDF with MS Word, the resulting PDF has the same font size. However, if I do it with the attached code, the result is different, usually larger.

The PDF is saved to disk using the PDFViewer control and the Save method.

What's the difference in pixel/point units? I've attached screenshots of the DOCX file and the code for the conversion.

Regards,

Jesús


Attachment: Adventure_Works_e646fe07.rar

6 Replies

SG Suresh Ganesan Syncfusion Team April 14, 2025 03:39 PM UTC

Hi Jesus,

Currently we are checking with the PDF viewer team and will share the more details within one day.

Regards,
Suresh Ganesan



SA Sivakumar Alagusundharam Syncfusion Team April 15, 2025 05:00 PM UTC

Hi Jesus,

We have reproduced the font size issue when viewing the converted PDF in Adobe on our end. We will validate this issue and update you with more details on 17th April 2025.

Regards,
Sivakumar. A




SR Sindhu Ramesh Syncfusion Team April 16, 2025 05:19 PM UTC

Jesus,
Upon further analysis, we observed that the font size in the generated PDF, as well as in the PDF viewer on our side, appears as 20. However, in the screenshot you provided, the font size is shown as 16.

We have logged a bug report for the font size showing as 20 and are currently validating the issue. We will provide you with an update tomorrow.

For your reference, we have attached the sample used on our side along with a screenshot from Adobe Acrobat. Kindly modify the provided sample to reproduce the issue you are experiencing on your side, and share it with us. Additionally, please share the version of Adobe Acrobat Pro you are using on your end.

Regards,
Sindhu Ramesh.


Attachment: WPF_Sample_5db8d98f.zip


JE Jesús April 16, 2025 09:52 PM UTC

Hi  Sindhu

Attached:

A test project

In the project's Debug folder is the .Docx file I worked with, the result of the PDF conversion, and a screenshot of Acrobat Pro version 2024.002.20687 | 64-bit. The font size in the .Docx file is Calibri /12, and in the PDF file, it's Calibri 16. Or at least that's what I see when editing text in Acrobat.


Thanks!!!

Regards


Jesús


Attachment: ConvertDocToPDF_7be72e58.rar


SG Suresh Ganesan Syncfusion Team April 17, 2025 04:01 PM UTC

Jesus,
Currently we are validating the reported issue with high priority. We will update you with more details within two days.

Regards,
Suresh Ganesan



SR Sindhu Ramesh Syncfusion Team April 22, 2025 04:31 PM UTC

Jesus,
Upon further analysis, on the .NET Framework platform, we are converting a Word document to PDF using the EMF to PDF approach. During this process, we first convert the Word document to EMF internally and then convert that EMF to PDF using the data in the EMF file.

In this process, an EMF file is created with pixels, and the EMF content is rendered using points. Our Syncfusion PDF library used a scaling approach to manage this point-based data. This difference in how unit systems are handled across components is likely the reason for the inconsistent output sizes in Adobe Acrobat Pro. This is the current architectural design for the EMF to PDF approach.

We recommend enabling the EnableFastRendering API as a workaround to resolve the issue. Please refer to the highlighted code snippet.

private void Button_Click(object sender, RoutedEventArgs e)

{

   OpenFileDialog openFileDialog = new OpenFileDialog();

   openFileDialog.Filter = "Archivos Word (*.docx;*.doc)|*.docx;*.doc";

   openFileDialog.Title = "Seleccione un archivo Word";

 

  try

  {

      if (openFileDialog.ShowDialog().Value)

      {

          WordDocument document = new WordDocument(openFileDialog.FileName, FormatType.Docx);

 

          // Instantiation of DocToPDFConverter for Word to PDF conversion

          DocToPDFConverter converter = new DocToPDFConverter();

 

          // Enable fast rendering using direct PDF conversion

          converter.Settings.EnableFastRendering = true;

 

          // Converts Word document into PDF document

          PdfDocument pdfDocument = converter.ConvertToPDF(document);

           pdfDocument.DocumentInformation.Title = "Pdf from Word " + openFileDialog.FileName;

 

           pdfDocument.Save(openFileDialog.FileName + ".pdf");

          pdfDocument.Close(true);

      }

  }

  catch (Exception ex)

  {

      MessageBox.Show(ex.Message, "Excepcion en conversion Word a PDF", MessageBoxButton.OK, MessageBoxImage.Error);

  }

}


While enabling the EnableFastRendering API in the settings, no intermediate EMF process occurs; we directly convert the Word document to PDF.


Loader.
Up arrow icon