DPI setting ignored when converting MSG to PDF in .NET

Hello,

Converting the attached MSG file to PDF, creates a document with as size of 10.42 x 14.74 inch, according to Adobe Reader.
image.png (66.0 KB)

With the specified 750 x 1061 pixels at the default 96 dpi, that should be 7.81 x 11.05 inch.
Changing the DPI value does not make any difference.
It seems to use 72 dpi internally, although 96 should be the default.

We were using that sample code for conversion:

            using (var conv = new Converter(documentPath))
            {
                var options = new PdfConvertOptions()
                {
                    //Dpi = 96
                    PageWidth = 750,
                    PageHeight = 1061,
                    MarginLeft = 15,
                    MarginRight = 15,
                    MarginBottom = 15,
                    MarginTop = 15
                };

                conv.Convert("Conversion.pdf", options);
            }

We’re using GroupDocs.Conversion from GroupDocs.Total.NETFramework package 25.6.
Can you please check that issue?

Here is some sample MSG, but the problem seems to happen with any email:
Webinar Introduction to Therefore.zip (36.7 KB)

@Clemens

It seems that you are experiencing issues with the DPI setting being ignored when converting MSG files to PDF using the GroupDocs.Conversion library in .NET. The output PDF is larger than expected, and changing the DPI value does not seem to affect the conversion.

To address this issue, you can try the following steps:

  1. Ensure Proper DPI Setting: Make sure that you are correctly setting the DPI in the PdfConvertOptions. The DPI property should be set explicitly in your options. For example:

    var options = new PdfConvertOptions()
    {
        Dpi = 96, // Set the desired DPI
        PageWidth = 750,
        PageHeight = 1061,
        MarginLeft = 15,
        MarginRight = 15,
        MarginBottom = 15,
        MarginTop = 15
    };
    
  2. Check for Updates: Since you are using version 25.6 of the GroupDocs.Total.NETFramework package, consider checking if there are any updates or newer versions available. Sometimes, issues like these are resolved in later releases.

  3. Review Documentation: The GroupDocs documentation provides detailed information on how to customize the conversion options, including DPI settings. You can refer to the section on converting to PDF with advanced options for more insights on how to properly configure your conversion settings here.

  4. Testing with Different DPI Values: If the DPI setting is still being ignored, try testing with different DPI values to see if there is any change in the output size. Sometimes, specific values may yield unexpected results.

  5. Contact Support: If the issue persists after trying the above steps, consider reaching out to GroupDocs support for further assistance. They may have more insights or solutions specific to your version and use case.

By following these steps, you should be able to troubleshoot the DPI issue during the MSG to PDF conversion process. If you have any further questions or need additional assistance, feel free to ask!

Sources:
[1]: Convert MSG to PDF | GroupDocs.Conversion .NET API
[2]: Convert to PDF with advanced options | Documentation

Hi,

Did anybody have time to check that issue yet?
The answer from the bot was not helping.

Best regards,
Clemens

Hello @Clemens ,

We apologize for the delay in investigating the issue. The problem has been successfully reproduced on our side. We’ve logged it with our development team under the ticket ID CONVERSIONNET-7911 and linked it to your case. Rest assured, we’ll update you as soon as we have any progress to share.

1 Like

Hello @Clemens ,

We have received feedback from our developers regarding this case, and it turns out that this is not a bug.

The formula inches = pixels / DPI cannot be applied to calculate the page size when converting a document to PDF format.

In cases of conversion to Word or PDF formats, properties such as PageHeight and PageWidth use points as measurement units. The applicable conversion rule here is: 1 pt = 1/72 inch.

Based on the example you provided, the resulting document page size will be:

  • PageWidth: 750 pt / 72 = 10.42 in
  • PageHeight: 1061 pt / 72 = 14.7 in

We’d also like to highlight that the Dpi property is not used for defining the output document’s page size. It is relevant for:

  1. Embedded raster images (it tells printers/viewers what size to render these images)
  2. Rasterizing a PDF file (e.g., for on-screen viewing or printing)

We apologize for the confusion. If you still have any questions, please don’t hesitate to contact us.

1 Like

Hi @evgen.efimov ,

Thank you for the clarification!
Then I will rather adjust the width and height properties, to get the desired output size.

Best regards,
Clemens

Hello @Clemens ,

Happy to help! Let me know if you run into anything else.

1 Like