ExporttoPNG custom width and height not working

When using ExporttoPNG with the additional_settings width and height attributes has no effect. The image is always 283x1037. Any thoughts on why?

gantt.exportToPNG({raw: false, additional_settngs:{width: 3295,height: 2551}});

If I use the export with raw: true, I get an image of size 1278x1395 with all my top custom labels at the bottom of the image.

Hello,
There is a typo in your code. Instead of additional_settngs, it should be additional_settings.

Please see an example: DHTMLX Snippet Tool

Thanks :face_with_open_eyes_and_hand_over_mouth:, a bit embarrassing.

I found if I choose the raw option, it exports with an appropriate width/height ratio. However, my custom labels above the tasks do not export in the correct location, they all show at the bottom. Thoughts on how to correct that?


Hello,
Could you please confirm if you’ve applied custom styles to the header property? Please see the related article: Export to PDF and PNG Gantt Docs

Hi Maksim,
I checked my style export and I was missing the new styles I added for the positioning of the text above the task bar. I added those to the header property and it exported as expected. Thanks again for you help.

1 Like