Export PDF on multiple pages

Is it possible to tell the export function how many tasks i would like to have per page. Currently the export function builds one single page which is not what satisfies our needs.

Hello Nikolai,
There is no built-in feature to do that. You need to implement a custom solution using Gantt API and Javascript.
Here is an example of how it might be implemented:
http://snippet.dhtmlx.com/061e52cd5

Hello Nikolai,

The dev team added a way to export the chart to several pages. To use that feature, you need to apply additional_settings. There, you need to use the width and height parameters or the format parameter.
Technically, Gantt is displayed on several pages, but in most cases, it won’t fit the specified width:
https://docs.dhtmlx.com/gantt/api__gantt_exporttopdf.html

When Gantt is exported, only its leftmost part is exported to the PDF document each time. Thus, to implement multi-page export, it is necessary to export Gantt several times, shifting Gantt to the left each time.

To shift Gantt in the exported file, you need to add the following style rule to #gantt_here in the header parameter:

var width = 1000;
var height = 1000;
var total_width = gantt.$task_bg.scrollWidth + gantt.$grid.scrollWidth;
 
for (var i = 0; i < total_width; i += width) {
    gantt.exportToPDF({
        header:`<style>#gantt_here{left:-${i}px;position: absolute;}</style>`,
        //raw: true,
        additional_settings:{
            width: width,
            height: height,
        }
    });
}

https://snippet.dhtmlx.com/5/d8462d9e6

In case you want to export Gantt to the specific format (‘A4’, for example), note, that the file format is defined in millimeters but the size in HTML is specified in pixels. Therefore, you need to convert the shift value from millimeters to pixels.

var widthMM = 297;
var width = widthMM / (25.4 inch / 144 PDF PPI);

https://snippet.dhtmlx.com/5/a4a4e62e3