Hello,
My timeline seems to only export those parts that I’ve made visible on the screen. I would like the entire timeline and all its tasks to be exported.
The chart is not fully visible in the exported file because of a bug that is related to the layout configuration. We are aware of that. The dev team will fix it in the future, but I cannot give you any ETA.
As a workaround, you can add a CSS rule to increase the timeline width:
gantt.exportToPDF({
header: `.timeline_cell{width: ${gantt.$task_data.scrollWidth}px !important;}`,
raw: true
});
Please check the following example of how it might be implemented:
https://snippet.dhtmlx.com/jjehcruv
Or you can use the autosize
option to stretch the grid, then restore the previous width. There is an article about autosize
property:
https://docs.dhtmlx.com/gantt/api__gantt_autosize_config.html
For example, like this:
gantt.config.autosize = 'x';
gantt.exportToPDF({
raw: true
});
gantt.config.autosize = false;
gantt.$container.parentNode.style.width = '100%';
gantt.render()
Please check the following snippet:
https://snippet.dhtmlx.com/daszerbx
I’ve also noticed that when I have 100s of rows the lower onces are returning blank when exported.
I’ve tried to reproduce what you’ve described on this example:
https://snippet.dhtmlx.com/d77fsa8d
but it works correctly to me. It’s hard to suggest what exactly goes wrong without more details, so could you please provide me a detailed instruction on how to reproduce it or provide me a simplified demo?
Finally I have a second grid/timeline that shows holiday dates, but when exported the width of this grid does not match the width of the other.
To export the whole gantt markup as it is, with all custom elements, you can set the raw: true
property in the parameter of the exportToPDF/exportToPNG methods. There is an article about it:
https://docs.dhtmlx.com/gantt/desktop__export.html#exportingcustommarkupandstyles
In addition, you can add styles to the header
of the exportToPDF/exportToPNG methods so that the weekends will be highlighted in the exported file:
<style> gantt.exportToPDF({ name:"calendar.pdf", header:'<style>... custom css classes here ...</style>' }); </style.
If you have additional questions, write to us, and we will try to help you.