Picture aspect ratio distorted when exporting worksheet to PDF

Posted by: minhhieu2032000 on 13 August 2026, 6:10 am EST

    • Post Options:
    • Link

    Posted 13 August 2026, 6:10 am EST - Updated 13 August 2026, 6:15 am EST

    When exporting a worksheet to PDF via Workbook.Save(stream, SaveFileFormat.Pdf), a picture that is already embedded in the .xlsx template (not inserted programmatically) is rendered with a distorted aspect ratio — visibly wider/shorter than the original image. The same worksheet, when opened in real Microsoft Excel and exported to PDF from there (Save As PDF), renders the picture with the correct proportions.

    Repro steps:

    Open a template .xlsx that contains a static picture shape (e.g. a badge/logo image anchored to a cell range).

    Load it with Workbook.Open(templatePath).

    Save directly to PDF: workbook.Save(stream, SaveFileFormat.Pdf).

    Compare the picture in the resulting PDF against: (a) the same picture as shown in Excel, and (b) a PDF produced by opening the same .xlsx in Microsoft Excel and using File > Save As > PDF.

    Expected: The picture’s aspect ratio in the DioDocs-exported PDF should match its original aspect ratio / match Excel’s own PDF export.

    Actual: The picture is stretched (wider relative to height) in the DioDocs PDF export. See attached screenshot — left side is the PDF exported by DioDocs, right side is the PDF exported by Excel from the identical file; same picture, clearly different aspect ratio.

    Question: Is this a known limitation of picture rendering in the PDF export pipeline? Is there any API/setting to make picture aspect ratio in the exported PDF match Excel’s native rendering?

  • Posted 14 August 2026, 5:41 am EST

    Hello ,

    Thank you for sharing the detailed reproduction steps and the screenshot.

    We were able to reproduce the issue on our end. We investigated and found that this behavior was previously escalated to the development team. They investigated and confirmed that it is a limitation of DioDocs.

    They explained that the image size in Excel is related to the row height and column width of the cells. Column width is calculated as the number of characters multiplied by the width of a single character. Since the single-character width on the screen and in the PDF is different, the column width on the screen and in the exported PDF can differ. However, the row height is a fixed-point value. Therefore, even Excel’s own PDF export cannot guarantee the aspect ratio.

    We apologize for the inconvenience this has caused, but unfortunately, there is no workaround available for this issue at the moment.

    We hope you understand. Please let us know if you have any other questions.

    Best regards,

    Vivek Singh

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels