exportToPNG timeline is not applying grid_row_class styles

When using the exportToPNG, the timeline portion of the image is not scaled correctly. The only way to get a reasonable representation of the report is to use the raw option. However, using the raw option increases the time to produce the export and often times out before the rendering is complete. In the exportToPNG header attribute, I added my custom styles and the export looks pretty good. However, I cannot get my custom row styling introduced via the gantt.templates.grid_row_class function to render correctly though.

Hello Stephen,
The templates are functions. So, they are not sent to the export server for security reasons. For the same reason, even if you send the Javascript code, it will be removed.
So, it is expected and recommended to use the raw mode:

When you use the raw mode, Gantt sends HTML elements to the export server, so it looks the same way as you see in the browser (of course, you also need to include the styles).
Usually, the task data is smaller than the DOM structure of Gantt. That’s why it takes more time to send the data to the export server.

If you have the license for the standalone export module, you can download it from the Client’s Area and install on your server:

Then, you won’t have the 20-second limitation and will be able to export large charts to PDF. The maximal sizes for PNG export are limited, but there is a way to export the data into the slices: