Angular 5 download gantt as PDF/PNG

I’ve tried to export my gantt to PDF/PNG by call gantt.exportToPDF() (both with callback option or no option).
Your server alway return blank file.

I’ve check request it’s already contain my data

gantt (1).pdf (8.7 KB)

Hello Long,
Unfortunately, I couldn’t reproduce the issue when I call gantt.exportToPDF() function without parameters. Here is the demo with Angular 7 and the export function:
https://files.dhtmlx.com/30d/aad8be77c62b14da73467062a27cfe28/angular7+export.zip

The issue might not be related to Angular, it can happen in regular Gantt chart if you use raw: true parameter and specify the data with the data: <object> parameter. The dev team will fix it in the future. The expected behavior is to ignore the data parameter.

I use Gantt 6.0.2.

I have implemented all gantt export function and call in the same chart (call export function with no params)

sample raw PDF request (with one task => return blank page)

type=pdf&store=1&data=%7B%22name%22%3A%22sitemage_gantt.pdf%22%2C%22data%22%3A%7B%22data%22%3A%5B%7B%22unscheduled%22%3Afalse%2C%22type%22%3A%22task%22%2C%22duration%22%3A1%2C%22text%22%3A%22Long%20task%201%22%2C%22id%22%3A998%2C%22parent%22%3A0%2C%22start_date%22%3A%2201-02-2019%2000%3A00%22%2C%22end_date%22%3A%2202-02-2019%2000%3A00%22%2C%22%241%22%3A%22Long%20task%201%22%2C%22%242%22%3A%22%22%2C%22%243%22%3A%22%22%2C%22%244%22%3A%22%22%2C%22_0%22%3A1%2C%22_2%22%3A%22%3Ci%20class%3D%5C%22fa%20fa-info-circle%5C%22%3E%3C%2Fi%3E%22%2C%22_6%22%3A%22%22%2C%22_7%22%3A%22%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%3Cdiv%20title%3D%5C%22Unassigned%5C%22%20class%3D%5C%22assignee_label%5C%22%3E%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cimg%20src%3D%5C%22assets%2Fimages%2Fuser.png%5C%22%3E%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fdiv%3E%22%2C%22_8%22%3A%22%3Cdiv%20class%3D’progress_outter’%3E%3Cdiv%20class%3D’progress_inner’%20style%3D’width%3A%20%2B0%25’%3E0%25%3C%2Fdiv%3E%3C%2Fdiv%3E%22%7D%2C%7B%22unscheduled%22%3Atrue%2C%22type%22%3A%22placeholder%22%2C%22duration%22%3A1%2C%22text%22%3A%22New%20task%22%2C%22id%22%3A1551945282760%2C%22parent%22%3A0%2C%22start_date%22%3A%2201-02-2019%2000%3A00%22%2C%22end_date%22%3A%2202-02-2019%2000%3A00%22%2C%22%241%22%3A%22New%20task%22%2C%22%242%22%3A%22%22%2C%22%243%22%3A%22%22%2C%22%244%22%3A%22%22%2C%22_0%22%3A2%2C%22_2%22%3A%22%3Ci%20class%3D%5C%22fa%20fa-info-circle%5C%22%3E%3C%2Fi%3E%22%2C%22_6%22%3A%22%22%2C%22_7%22%3A%22%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%3Cdiv%20title%3D%5C%22Unassigned%5C%22%20class%3D%5C%22assignee_label%5C%22%3E%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cimg%20src%3D%5C%22assets%2Fimages%2Fuser.png%5C%22%3E%5Cn%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fdiv%3E%22%2C%22_8%22%3A%22%3Cdiv%20class%3D’progress_outter’%3E%3Cdiv%20class%3D’progress_inner’%20style%3D’width%3A%20%2B0%25’%3E0%25%3C%2Fdiv%3E%3C%2Fdiv%3E%22%7D%5D%2C%22links%22%3A%5B%7B%22id%22%3A1142%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A766%2C%22target%22%3A767%2C%22type%22%3A0%2C%22lag%22%3A0%2C%22created_at%22%3A%222019-03-07T03%3A40%3A47.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A47.000Z%22%2C%22sys_status%22%3A1%7D%2C%7B%22id%22%3A1143%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A767%2C%22target%22%3A768%2C%22type%22%3A1%2C%22lag%22%3A7%2C%22created_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22sys_status%22%3A1%7D%2C%7B%22id%22%3A1145%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A767%2C%22target%22%3A768%2C%22type%22%3A1%2C%22lag%22%3A7%2C%22created_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22sys_status%22%3A1%7D%2C%7B%22id%22%3A1147%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A766%2C%22target%22%3A767%2C%22type%22%3A0%2C%22lag%22%3A0%2C%22created_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22sys_status%22%3A1%7D%2C%7B%22id%22%3A1149%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A767%2C%22target%22%3A768%2C%22type%22%3A1%2C%22lag%22%3A7%2C%22created_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22sys_status%22%3A1%7D%2C%7B%22id%22%3A1150%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A768%2C%22target%22%3A769%2C%22type%22%3A0%2C%22lag%22%3A0%2C%22created_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A51.000Z%22%2C%22sys_status%22%3A1%7D%2C%7B%22id%22%3A1153%2C%22organization_id%22%3A208%2C%22project_id%22%3A111%2C%22source%22%3A768%2C%22target%22%3A769%2C%22type%22%3A0%2C%22lag%22%3A0%2C%22created_at%22%3A%222019-03-07T03%3A40%3A52.000Z%22%2C%22updated_at%22%3A%222019-03-07T03%3A40%3A52.000Z%22%2C%22sys_status%22%3A1%7D%5D%7D%2C%22config%22%3A%7B%22layout%22%3A%7B%22cols%22%3A%5B%7B%22width%22%3A615%2C%22min_width%22%3A300%2C%22rows%22%3A%5B%7B%22view%22%3A%22grid%22%2C%22scrollX%22%3A%22gridScroll%22%2C%22scrollable%22%3Atrue%2C%22scrollY%22%3A%22scrollVer%22%7D%2C%7B%22view%22%3A%22scrollbar%22%2C%22id%22%3A%22gridScroll%22%2C%22group%22%3A%22horizontal%22%7D%5D%7D%2C%7B%22resizer%22%3Atrue%2C%22width%22%3A1%7D%2C%7B%22rows%22%3A%5B%7B%22view%22%3A%22timeline%22%2C%22scrollX%22%3A%22scrollHor%22%2C%22scrollY%22%3A%22scrollVer%22%7D%2C%7B%22view%22%3A%22scrollbar%22%2C%22id%22%3A%22scrollHor%22%2C%22group%22%3A%22horizontal%22%7D%5D%7D%2C%7B%22view%22%3A%22scrollbar%22%2C%22id%22%3A%22scrollVer%22%7D%5D%2C%22id%22%3A%22main%22%7D%2C%22links%22%3A%7B%22finish_to_start%22%3A%220%22%2C%22start_to_start%22%3A%221%22%2C%22finish_to_finish%22%3A%222%22%2C%22start_to_finish%22%3A%223%22%7D%2C%22types%22%3A%7B%22task%22%3A%22task%22%2C%22project%22%3A%22project%22%2C%22milestone%22%3A%22milestone%22%2C%22placeholder%22%3A%22placeholder%22%7D%2C%22auto_types%22%3Atrue%2C%22duration_unit%22%3A%22day%22%2C%22work_time%22%3Afalse%2C%22correct_work_time%22%3Afalse%2C%22skip_off_time%22%3Afalse%2C%22cascade_delete%22%3Atrue%2C%22autosize%22%3Afalse%2C%22autosize_min_width%22%3A0%2C%22autoscroll%22%3Atrue%2C%22autoscroll_speed%22%3A30%2C%22show_links%22%3Atrue%2C%22show_task_cells%22%3Atrue%2C%22static_background%22%3Afalse%2C%22branch_loading%22%3Afalse%2C%22branch_loading_property%22%3A%22%24has_child%22%2C%22show_loading%22%3Afalse%2C%22show_chart%22%3Atrue%2C%22show_grid%22%3Atrue%2C%22min_duration%22%3A3600000%2C%22xml_date%22%3A%22%25d-%25m-%25Y%20%25H%3A%25i%22%2C%22api_date%22%3A%22%25d-%25m-%25Y%20%25H%3A%25i%22%2C%22start_on_monday%22%3Atrue%2C%22server_utc%22%3Afalse%2C%22show_progress%22%3Atrue%2C%22fit_tasks%22%3Atrue%2C%22select_task%22%3Atrue%2C%22scroll_on_click%22%3Atrue%2C%22preserve_scroll%22%3Atrue%2C%22readonly%22%3Afalse%2C%22date_grid%22%3A%22%25d%2F%25m%2F%25y%22%2C%22drag_links%22%3Atrue%2C%22drag_progress%22%3Atrue%2C%22drag_resize%22%3Atrue%2C%22drag_project%22%3Afalse%2C%22drag_move%22%3Atrue%2C%22drag_mode%22%3A%7B%22resize%22%3A%22resize%22%2C%22progress%22%3A%22progress%22%2C%22move%22%3A%22move%22%2C%22ignore%22%3A%22ignore%22%7D%2C%22round_dnd_dates%22%3Atrue%2C%22link_wrapper_width%22%3A20%2C%22root_id%22%3A0%2C%22autofit%22%3Afalse%2C%22columns%22%3A%5B%7B%22name%22%3A%22index%22%2C%22label%22%3A%22No%22%2C%22width%22%3A35%2C%22%24template%22%3Atrue%7D%2C%7B%22name%22%3A%22text%22%2C%22label%22%3A%22T%C3%AAn%20c%C3%B4ng%20vi%E1%BB%87c%22%2C%22tree%22%3Atrue%2C%22width%22%3A230%2C%22editor%22%3A%7B%22type%22%3A%22text%22%2C%22map_to%22%3A%22text%22%7D%2C%22resize%22%3Atrue%7D%2C%7B%22name%22%3A%22detail%22%2C%22width%22%3A23%2C%22%24template%22%3Atrue%7D%2C%7B%22name%22%3A%22duration%22%2C%22label%22%3A%22Duration%22%2C%22width%22%3A50%2C%22align%22%3A%22center%22%2C%22editor%22%3A%7B%22type%22%3A%22number%22%2C%22map_to%22%3A%22duration%22%2C%22min%22%3A0%2C%22max%22%3A100%7D%2C%22resize%22%3Atrue%7D%2C%7B%22name%22%3A%22start_date%22%2C%22label%22%3A%22Start%22%2C%22width%22%3A80%2C%22align%22%3A%22center%22%2C%22editor%22%3A%7B%22type%22%3A%22date%22%2C%22map_to%22%3A%22start_date%22%2C%22min%22%3A%222017-12-31T17%3A00%3A00.000Z%22%2C%22max%22%3A%222018-12-31T17%3A00%3A00.000Z%22%7D%2C%22resize%22%3Atrue%7D%2C%7B%22name%22%3A%22end_date%22%2C%22label%22%3A%22Finish%22%2C%22width%22%3A80%2C%22align%22%3A%22center%22%2C%22editor%22%3A%7B%22type%22%3A%22date%22%2C%22map_to%22%3A%22end_date%22%2C%22min%22%3A%222017-12-31T17%3A00%3A00.000Z%22%2C%22max%22%3A%222018-12-31T17%3A00%3A00.000Z%22%7D%2C%22resize%22%3Atrue%7D%2C%7B%22name%22%3A%22predecessors%22%2C%22label%22%3A%22Predecessors%22%2C%22width%22%3A80%2C%22align%22%3A%22left%22%2C%22editor%22%3A%7B%22type%22%3A%22predecessors_editor%22%7D%2C%22resize%22%3Atrue%2C%22%24template%22%3Atrue%7D%2C%7B%22name%22%3A%22owner%22%2C%22align%22%3A%22center%22%2C%22width%22%3A35%2C%22label%22%3A%22%20%22%2C%22%24template%22%3Atrue%7D%2C%7B%22name%22%3A%22progress%22%2C%22label%22%3A%22%25%22%2C%22align%22%3A%22center%22%2C%22resize%22%3Atrue%2C%22width%22%3A40%2C%22editor%22%3A%7B%22type%22%3A%22number%22%2C%22map_to%22%3A%22progress%22%2C%22min%22%3A0%2C%22max%22%3A100%7D%2C%22%24template%22%3Atrue%7D%5D%2C%22step%22%3A1%2C%22scale_unit%22%3A%22month%22%2C%22scale_offset_minimal%22%3Afalse%2C%22subscales%22%3A%5B%7B%22unit%22%3A%22day%22%2C%22step%22%3A1%2C%22date%22%3A%22%25j%22%2C%22index%22%3A1%7D%5D%2C%22inherit_scale_class%22%3Afalse%2C%22time_step%22%3A60%2C%22duration_step%22%3A1%2C%22date_scale%22%3A%22Th%C3%A1ng%20%25m%2C%20%25Y%22%2C%22task_date%22%3A%22%25d%20%25F%20%25Y%22%2C%22time_picker%22%3A%22%25H%3A%25i%22%2C%22task_attribute%22%3A%22task_id%22%2C%22link_attribute%22%3A%22link_id%22%2C%22layer_attribute%22%3A%22data-layer%22%2C%22buttons_left%22%3A%5B%22gantt_save_btn%22%2C%22gantt_cancel_btn%22%5D%2C%22_migrate_buttons%22%3A%7B%22dhx_save_btn%22%3A%22gantt_save_btn%22%2C%22dhx_cancel_btn%22%3A%22gantt_cancel_btn%22%2C%22dhx_delete_btn%22%3A%22gantt_delete_btn%22%7D%2C%22buttons_right%22%3A%5B%22gantt_delete_btn%22%5D%2C%22lightbox%22%3A%7B%22sections%22%3A%5B%7B%22name%22%3A%22description%22%2C%22height%22%3A70%2C%22map_to%22%3A%22text%22%2C%22type%22%3A%22textarea%22%2C%22focus%22%3Atrue%7D%2C%7B%22name%22%3A%22time%22%2C%22type%22%3A%22duration%22%2C%22map_to%22%3A%22auto%22%7D%5D%2C%22project_sections%22%3A%5B%7B%22name%22%3A%22description%22%2C%22height%22%3A70%2C%22map_to%22%3A%22text%22%2C%22type%22%3A%22textarea%22%2C%22focus%22%3Atrue%7D%2C%7B%22name%22%3A%22type%22%2C%22type%22%3A%22typeselect%22%2C%22map_to%22%3A%22type%22%7D%2C%7B%22name%22%3A%22time%22%2C%22type%22%3A%22duration%22%2C%22readonly%22%3Atrue%2C%22map_to%22%3A%22auto%22%7D%5D%2C%22milestone_sections%22%3A%5B%7B%22name%22%3A%22description%22%2C%22height%22%3A70%2C%22map_to%22%3A%22text%22%2C%22type%22%3A%22textarea%22%2C%22focus%22%3Atrue%7D%2C%7B%22name%22%3A%22type%22%2C%22type%22%3A%22typeselect%22%2C%22map_to%22%3A%22type%22%7D%2C%7B%22name%22%3A%22time%22%2C%22type%22%3A%22duration%22%2C%22single_date%22%3Atrue%2C%22map_to%22%3A%22auto%22%7D%5D%7D%2C%22drag_lightbox%22%3Atrue%2C%22sort%22%3Afalse%2C%22details_on_create%22%3Atrue%2C%22details_on_dblclick%22%3Atrue%2C%22initial_scroll%22%3Atrue%2C%22task_scroll_offset%22%3A100%2C%22order_branch%22%3Atrue%2C%22order_branch_free%22%3Atrue%2C%22task_height%22%3A%22full%22%2C%22min_column_width%22%3A22%2C%22min_grid_column_width%22%3A70%2C%22grid_resizer_column_attribute%22%3A%22column_index%22%2C%22grid_resizer_attribute%22%3A%22grid_resizer%22%2C%22keep_grid_width%22%3Afalse%2C%22grid_resize%22%3Afalse%2C%22show_unscheduled%22%3Atrue%2C%22readonly_property%22%3A%22readonly%22%2C%22editable_property%22%3A%22editable%22%2C%22calendar_property%22%3A%22calendar_id%22%2C%22resource_calendars%22%3A%7B%7D%2C%22type_renderers%22%3A%7B%7D%2C%22open_tree_initially%22%3Atrue%2C%22optimize_render%22%3Atrue%2C%22prevent_default_scroll%22%3Afalse%2C%22show_errors%22%3Atrue%2C%22wai_aria_attributes%22%3Atrue%2C%22smart_scales%22%3Atrue%2C%22rtl%22%3Afalse%2C%22placeholder_task%22%3Atrue%2C%22editor_types%22%3A%7B%22text%22%3A%7B%7D%2C%22number%22%3A%7B%7D%2C%22select%22%3A%7B%7D%2C%22date%22%3A%7B%7D%2C%22predecessor%22%3A%7B%7D%2C%22predecessors_editor%22%3A%7B%7D%7D%2C%22resource_property%22%3A%22owner_id%22%2C%22resource_store%22%3A%22resource%22%2C%22resource_render_empty_cells%22%3Afalse%2C%22touch_drag%22%3A500%2C%22touch%22%3Afalse%2C%22touch_feedback%22%3Atrue%2C%22touch_feedback_duration%22%3A1%2C%22highlight_critical_path%22%3Afalse%2C%22auto_scheduling%22%3Atrue%2C%22auto_scheduling_descendant_links%22%3Afalse%2C%22auto_scheduling_initial%22%3Atrue%2C%22auto_scheduling_strict%22%3Atrue%2C%22auto_scheduling_move_projects%22%3Atrue%2C%22keyboard_navigation%22%3Atrue%2C%22keyboard_navigation_cells%22%3Atrue%2C%22multiselect%22%3Atrue%2C%22multiselect_one_level%22%3Afalse%2C%22show_markers%22%3Atrue%2C%22smart_rendering%22%3Atrue%2C%22undo_steps%22%3A10%2C%22undo%22%3Atrue%2C%22redo%22%3Atrue%2C%22undo_types%22%3A%7B%22link%22%3A%22link%22%2C%22task%22%3A%22task%22%7D%2C%22undo_actions%22%3A%7B%22update%22%3A%22update%22%2C%22remove%22%3A%22remove%22%2C%22add%22%3A%22add%22%2C%22move%22%3A%22move%22%7D%2C%22row_height%22%3A24%2C%22scroll_size%22%3A15%2C%22grid_width%22%3A653%2C%22scale_height%22%3A35%2C%22link_line_width%22%3A2%2C%22link_arrow_size%22%3A6%2C%22lightbox_additional_height%22%3A75%7D%2C%22version%22%3A%226.0.2%22%7D

sample Parse request

type: pdf
store: 1
data:
{“name”:“sitemage_gantt.pdf”,“data”:{“data”:[{“unscheduled”:false,“type”:“task”,“duration”:1,“text”:“Long task 1”,“id”:998,“parent”:0,“start_date”:“01-02-2019 00:00”,“end_date”:“02-02-2019 00:00”,"$1":“Long task 1”,"$2":"","$3":"","$4":"","_0":1,"_2":"<i class=“fa fa-info-circle”></i>","_6":"","_7":"\n <div title=“Unassigned” class=“assignee_label”>\n <img src=“assets/images/user.png”>\n </div>","_8":"<div class=‘progress_outter’><div class=‘progress_inner’ style=‘width: +0%’>0%</div></div>"},{“unscheduled”:true,“type”:“placeholder”,“duration”:1,“text”:“New task”,“id”:1551945282760,“parent”:0,“start_date”:“01-02-2019 00:00”,“end_date”:“02-02-2019 00:00”,"$1":“New task”,"$2":"","$3":"","$4":"","_0":2,"_2":"<i class=“fa fa-info-circle”></i>","_6":"","_7":"\n <div title=“Unassigned” class=“assignee_label”>\n <img src=“assets/images/user.png”>\n </div>","_8":"<div class=‘progress_outter’><div class=‘progress_inner’ style=‘width: +0%’>0%</div></div>"}],“links”:[{“id”:1142,“organization_id”:208,“project_id”:111,“source”:766,“target”:767,“type”:0,“lag”:0,“created_at”:“2019-03-07T03:40:47.000Z”,“updated_at”:“2019-03-07T03:40:47.000Z”,“sys_status”:1},{“id”:1143,“organization_id”:208,“project_id”:111,“source”:767,“target”:768,“type”:1,“lag”:7,“created_at”:“2019-03-07T03:40:51.000Z”,“updated_at”:“2019-03-07T03:40:51.000Z”,“sys_status”:1},{“id”:1145,“organization_id”:208,“project_id”:111,“source”:767,“target”:768,“type”:1,“lag”:7,“created_at”:“2019-03-07T03:40:51.000Z”,“updated_at”:“2019-03-07T03:40:51.000Z”,“sys_status”:1},{“id”:1147,“organization_id”:208,“project_id”:111,“source”:766,“target”:767,“type”:0,“lag”:0,“created_at”:“2019-03-07T03:40:51.000Z”,“updated_at”:“2019-03-07T03:40:51.000Z”,“sys_status”:1},{“id”:1149,“organization_id”:208,“project_id”:111,“source”:767,“target”:768,“type”:1,“lag”:7,“created_at”:“2019-03-07T03:40:51.000Z”,“updated_at”:“2019-03-07T03:40:51.000Z”,“sys_status”:1},{“id”:1150,“organization_id”:208,“project_id”:111,“source”:768,“target”:769,“type”:0,“lag”:0,“created_at”:“2019-03-07T03:40:51.000Z”,“updated_at”:“2019-03-07T03:40:51.000Z”,“sys_status”:1},{“id”:1153,“organization_id”:208,“project_id”:111,“source”:768,“target”:769,“type”:0,“lag”:0,“created_at”:“2019-03-07T03:40:52.000Z”,“updated_at”:“2019-03-07T03:40:52.000Z”,“sys_status”:1}]},“config”:{“layout”:{“cols”:[{“width”:615,“min_width”:300,“rows”:[{“view”:“grid”,“scrollX”:“gridScroll”,“scrollable”:true,“scrollY”:“scrollVer”},{“view”:“scrollbar”,“id”:“gridScroll”,“group”:“horizontal”}]},{“resizer”:true,“width”:1},{“rows”:[{“view”:“timeline”,“scrollX”:“scrollHor”,“scrollY”:“scrollVer”},{“view”:“scrollbar”,“id”:“scrollHor”,“group”:“horizontal”}]},{“view”:“scrollbar”,“id”:“scrollVer”}],“id”:“main”},“links”:{“finish_to_start”:“0”,“start_to_start”:“1”,“finish_to_finish”:“2”,“start_to_finish”:“3”},“types”:{“task”:“task”,“project”:“project”,“milestone”:“milestone”,“placeholder”:“placeholder”},“auto_types”:true,“duration_unit”:“day”,“work_time”:false,“correct_work_time”:false,“skip_off_time”:false,“cascade_delete”:true,“autosize”:false,“autosize_min_width”:0,“autoscroll”:true,“autoscroll_speed”:30,“show_links”:true,“show_task_cells”:true,“static_background”:false,“branch_loading”:false,“branch_loading_property”:"$has_child",“show_loading”:false,“show_chart”:true,“show_grid”:true,“min_duration”:3600000,“xml_date”:"%d-%m-%Y %H:%i",“api_date”:"%d-%m-%Y %H:%i",“start_on_monday”:true,“server_utc”:false,“show_progress”:true,“fit_tasks”:true,“select_task”:true,“scroll_on_click”:true,“preserve_scroll”:true,“readonly”:false,“date_grid”:"%d/%m/%y",“drag_links”:true,“drag_progress”:true,“drag_resize”:true,“drag_project”:false,“drag_move”:true,“drag_mode”:{“resize”:“resize”,“progress”:“progress”,“move”:“move”,“ignore”:“ignore”},“round_dnd_dates”:true,“link_wrapper_width”:20,“root_id”:0,“autofit”:false,“columns”:[{“name”:“index”,“label”:“No”,“width”:35,"$template":true},{“name”:“text”,“label”:“Tên công việc”,“tree”:true,“width”:230,“editor”:{“type”:“text”,“map_to”:“text”},“resize”:true},{“name”:“detail”,“width”:23,"$template":true},{“name”:“duration”,“label”:“Duration”,“width”:50,“align”:“center”,“editor”:{“type”:“number”,“map_to”:“duration”,“min”:0,“max”:100},“resize”:true},{“name”:“start_date”,“label”:“Start”,“width”:80,“align”:“center”,“editor”:{“type”:“date”,“map_to”:“start_date”,“min”:“2017-12-31T17:00:00.000Z”,“max”:“2018-12-31T17:00:00.000Z”},“resize”:true},{“name”:“end_date”,“label”:“Finish”,“width”:80,“align”:“center”,“editor”:{“type”:“date”,“map_to”:“end_date”,“min”:“2017-12-31T17:00:00.000Z”,“max”:“2018-12-31T17:00:00.000Z”},“resize”:true},{“name”:“predecessors”,“label”:“Predecessors”,“width”:80,“align”:“left”,“editor”:{“type”:“predecessors_editor”},“resize”:true,"$template":true},{“name”:“owner”,“align”:“center”,“width”:35,“label”:" “,”$template":true},{“name”:“progress”,“label”:"%",“align”:“center”,“resize”:true,“width”:40,“editor”:{“type”:“number”,“map_to”:“progress”,“min”:0,“max”:100},"$template":true}],“step”:1,“scale_unit”:“month”,“scale_offset_minimal”:false,“subscales”:[{“unit”:“day”,“step”:1,“date”:"%j",“index”:1}],“inherit_scale_class”:false,“time_step”:60,“duration_step”:1,“date_scale”:“Tháng %m, %Y”,“task_date”:"%d %F %Y",“time_picker”:"%H:%i",“task_attribute”:“task_id”,“link_attribute”:“link_id”,“layer_attribute”:“data-layer”,“buttons_left”:[“gantt_save_btn”,“gantt_cancel_btn”],"_migrate_buttons":{“dhx_save_btn”:“gantt_save_btn”,“dhx_cancel_btn”:“gantt_cancel_btn”,“dhx_delete_btn”:“gantt_delete_btn”},“buttons_right”:[“gantt_delete_btn”],“lightbox”:{“sections”:[{“name”:“description”,“height”:70,“map_to”:“text”,“type”:“textarea”,“focus”:true},{“name”:“time”,“type”:“duration”,“map_to”:“auto”}],“project_sections”:[{“name”:“description”,“height”:70,“map_to”:“text”,“type”:“textarea”,“focus”:true},{“name”:“type”,“type”:“typeselect”,“map_to”:“type”},{“name”:“time”,“type”:“duration”,“readonly”:true,“map_to”:“auto”}],“milestone_sections”:[{“name”:“description”,“height”:70,“map_to”:“text”,“type”:“textarea”,“focus”:true},{“name”:“type”,“type”:“typeselect”,“map_to”:“type”},{“name”:“time”,“type”:“duration”,“single_date”:true,“map_to”:“auto”}]},“drag_lightbox”:true,“sort”:false,“details_on_create”:true,“details_on_dblclick”:true,“initial_scroll”:true,“task_scroll_offset”:100,“order_branch”:true,“order_branch_free”:true,“task_height”:“full”,“min_column_width”:22,“min_grid_column_width”:70,“grid_resizer_column_attribute”:“column_index”,“grid_resizer_attribute”:“grid_resizer”,“keep_grid_width”:false,“grid_resize”:false,“show_unscheduled”:true,“readonly_property”:“readonly”,“editable_property”:“editable”,“calendar_property”:“calendar_id”,“resource_calendars”:{},“type_renderers”:{},“open_tree_initially”:true,“optimize_render”:true,“prevent_default_scroll”:false,“show_errors”:true,“wai_aria_attributes”:true,“smart_scales”:true,“rtl”:false,“placeholder_task”:true,“editor_types”:{“text”:{},“number”:{},“select”:{},“date”:{},“predecessor”:{},“predecessors_editor”:{}},“resource_property”:“owner_id”,“resource_store”:“resource”,“resource_render_empty_cells”:false,“touch_drag”:500,“touch”:false,“touch_feedback”:true,“touch_feedback_duration”:1,“highlight_critical_path”:false,“auto_scheduling”:true,“auto_scheduling_descendant_links”:false,“auto_scheduling_initial”:true,“auto_scheduling_strict”:true,“auto_scheduling_move_projects”:true,“keyboard_navigation”:true,“keyboard_navigation_cells”:true,“multiselect”:true,“multiselect_one_level”:false,“show_markers”:true,“smart_rendering”:true,“undo_steps”:10,“undo”:true,“redo”:true,“undo_types”:{“link”:“link”,“task”:“task”},“undo_actions”:{“update”:“update”,“remove”:“remove”,“add”:“add”,“move”:“move”},“row_height”:24,“scroll_size”:15,“grid_width”:653,“scale_height”:35,“link_line_width”:2,“link_arrow_size”:6,“lightbox_additional_height”:75},“version”:“6.0.2”}

Hello Long,
Unfortunately, I couldn’t reproduce the issue with the data you sent (maybe because I needed to adapt it to the snippet and fix the JSON data).
Please reproduce the issue in the snippet or send me your full project where I can reproduce the issue.

I’ve fixed this issue by export with {raw: true} param.

But, pdf export alway in A4 layout, it’s not resize vertical as gantt start_date and end_date.
And int pdf, it’s only include visible tasks in screen (about 20 tasks), not all tasks in gantt.

(In this snippet, pdf export is very good: http://snippet.dhtmlx.com/27fa002b2).

I’m using dhtmlx gantt 6.3.0 trial version, should I purchase gantt to use full function of pdf export ?

Hi @long241191,
You can use the full functionality of pdf export without purchasing the gantt.

According to the first question:

But, pdf export alway in A4 layout, it’s not resized vertically as gantt start_date and end_date.

Unfortunately, for now, there is no built-in way to change export layout, the dev team will implement it in the future, but I cannot give you any ETA.

According to the second question:

And int pdf, it only includes visible tasks in screen (about 20 tasks), not all tasks in gantt.

This issue occurs in versions of gantt below “6.2.7”, and it shouldn’t happen in v6.3.0. As a workaround solution, you could change gantt.config.smart_rendering to false before gantt.exportToPDF() call, and set it back to true, after that.
Don’t forget to reinitialize gantt after config changes, to make them appear.
Here is a demo: http://snippet.dhtmlx.com/b2a380237

Also, the issue could have occurred if the new version of the api.js haven’t been loaded automatically and you are using the old version from the browser cache, in order to fix it, you should clear your browser cache. And after that, specify the new version in the script file, like in this fragment:
<script src="https://export.dhtmlx.com/gantt/api.js?v=6.3.1"></script>

If, after using the solution from the demo above and after updating api.js, you still will have the issue with exporting tasks and links outside the visible part of the gantt, could you please provide some kind of demo, where I will be able to reproduce this issue?

1 Like

I’ve updated gantt export script to v6.3.1, all tasks in gantt now visibles in PDF

but, I’m using custom layout [gantt.config.layout] and right time line not in pdf as expected.
(By default, all task and time line visible in PDF, but after custom gantt.config.layout, pdf only render some time line - not all)
http://snippet.dhtmlx.com/8957f4d20

gantt.config.layout = {
  cols: [
    {
      width: 590,
      min_width: 300,
      rows: [
        { view: 'grid', scrollX: 'gridScroll', scrollable: true, scrollY: 'scrollVer' },
        { view: 'scrollbar', id: 'gridScroll', group: 'horizontal' }
      ]
    },
    { resizer: true, width: 1 },
    {
      rows: [
        { view: 'timeline', scrollX: 'scrollHor', scrollY: 'scrollVer' },
        { view: 'scrollbar', id: 'scrollHor', group: 'horizontal' }
      ]
    },
    { view: 'scrollbar', id: 'scrollVer' }
  ]
};

Hi @long241191,
It is a known bug, and we have it in our tracker. The dev team will fix it in the future, but I cannot give you an ETA.
The issue occurs when the layout config has “rows inside columns” structure so Gantt exports the data vertically. In that case, you need to specify the timeline column width to see it fully in the exported file:

...
        { resizer: true, width: 1 },
        {
		width: 2200,
          rows: [
            { view: 'timeline', scrollX: 'scrollHor', scrollY: 'scrollVer' },
            { view: 'scrollbar', id: 'scrollHor', group: 'horizontal' }
          ]
        },
...

Here is a demo:
http://snippet.dhtmlx.com/9ea103a4b

Otherwise, you can change the layout config structure to “columns inside rows”, like in this fragment:

gantt.config.layout = {
  css: "gantt_container",
  rows: [
    {
      cols:
      [
       {
         width: 590,
         min_width: 300,
        rows:[
          { view: "grid", scrollX: "gridScroll", scrollable: true, scrollY: "scrollVer" },
		  { view: "scrollbar", id: "gridScroll", group: "horizontal" }	          
        ]
       },
        { resizer: true, width: 1 },
        { view: "timeline", scrollX: "scrollHor", scrollY: "scrollVer" },
        { view: "scrollbar", id: "scrollVer" }
       ]
    },
    { view: "scrollbar", id: "scrollHor", group: "horizontal" }
  ]
};

Here is a demo:
http://snippet.dhtmlx.com/bf9bbd761

Also, you can define two gantt.config.layout, one for export and one for app. After that, you will be able to toggle between them while export, so your export function would look like this fragment:

function export_data(){
  gantt.config.layout = exportLayout;

  gantt.init("gantt_here");
  gantt.exportToPDF({
    raw:true
  }); 

  gantt.config.layout = usualLayout;
  gantt.init("gantt_here");
}

Here is a demo:
http://snippet.dhtmlx.com/eb0310511

1 Like

Thanks you :slight_smile: