Issue with Gantt export to PDF

Hi,

We are using DHTMLX Gantt export to PDF feature in our project. Export feature is working perfectly without any issue, but we have few concerns. When we export Gantt into PDF, it will export same layout as displayed in the web app. The problem is some column data are not displayed correctly. When we increase the width from Gantt and export, it will work. Is there any option to set column width same as text context of column rather than manually change it and export?

Thank you

Hello Madhuka,
There is no built-in way to do that. If you want to increase the width with the code, you can implement a custom solution.

Here is an example of the implementation:

    const text_cells = document.querySelectorAll(`[data-column-name="text"]`)
    let max_width = 0;
    text_cells.forEach(function (el) {
        if (max_width < el.scrollWidth) {
            max_width = el.scrollWidth
        }
    })

    const actual_width = gantt.config.columns[0].width;
    if (actual_width < max_width) {
        gantt.config.columns[0].min_width = max_width
        gantt.config.columns[0].width = max_width

        gantt.render()
    }
1 Like