Gantt Export to PDF Pagination cuttin tasks in half


#1

Hi,

We are using the export to pdf functionality of the Gantt. When we print our Gantt the pdf is cut in different pages. Which is fine, except for the fact that the pagination cuts the different tasks in half.
See snippet with example:
https://snippet.dhtmlx.com/5/84e94baed

Is their a way to have the export to pdf print in a way that it wil always paginate at the top/bottom of a task row?

Thanks in advance,
Mitch


#2

Hello Mitch,
Unfortunately, there is no built-in way to do that. When you export the data to several pages, you specify the sizes. If the task doesn’t fit the last part of the page, the size should be smaller or there should be a blank space.

Another possible solution would be to change the task row height. Right now, there is no built-in way to do that, but in the 7.1 version, Gantt will have that feature.
So, it would be possible to change the task height before exporting the data and revert the changes. I will ask the dev team to investigate it is possible to add an example of the implementation.


#3

Hi,

Thank you for your reply.

The problem with resizing the page is, if the first page finally fits, the rest of the pages doesn’t anymore.
And in my understanding it is not possible put in a decimal number for the size, so that isn’t an option either.

Do you have an example for me in which you have multiple pages and there is no cutting?

Thanks in advance,
Mitch


Tasks getting cut in PDF export
#4

Hello Mitch,
As I said in the previous message, there is no built-in way to do that.
Starting from the 7.1 version, it will be possible to try to implement a custom solution, but right now, there is no easy way to do that.


#5

Hi,

I wanted to inform you that I have found an easy way to fix it (for me at least).

It seems the Export to PDF functionality clones the Gantt chart and then does the export. In order to have it fit the pdf correctly, all you have to do is set the width and height of the export functionality to the width and height of the users screen in pixels.

At least, that is what helps for me. I hope it will help others to.

Greetings


#6

Hello Mitch,
Thank you for sharing your thoughts.
Yes, it should help. As long as the page ends with the task row border, the tasks shouldn’t tear up.
But it means that you need to change the height of the task rows. With some values, it would be perfect, with other values it won’t work. And you need to find the combination of the page size and task row height.
However, in the case of predefined sizes like A4 and when there is something above Gantt (in the header parameter), you need to use a different or more complex solution.


#7

Is the solution there now with the 7.1 version ? Pls let me know.


#8

Hello @bikramjit,

There is no built-in solution, but you can try one of the workarounds described in previous posts.

Here are options which allow controlling height of tasks:
Bar:
https://docs.dhtmlx.com/gantt/api__gantt_bar_height_config.html
Row:
https://docs.dhtmlx.com/gantt/api__gantt_row_height_config.html

So you can manipulate it, in order to make tasks fit the exported pages.