1、导出为PDF和PNG
要将甘特图导出为PDF文档,请执行以下步骤:
- 在页面中包含“https://export.dhtmlx.com/gantt/api.js”文件以启用在线导出服务:
<script src="codebase/dhtmlxgantt.js"></script> <script src="https://export.dhtmlx.com/gantt/api.js"></script> <link rel="stylesheet" href="codebase/dhtmlxgantt.css" type="text/css">
- 调用exportToPDF方法导出甘特图:
<input value="Export to PDF" type="button" οnclick='gantt.exportToPDF()'> <script> gantt.init("gantt_here"); gantt.parse(demo_tasks); </script>
2、导出为 PNG
要将甘特图导出为PNG图像,请执行以下步骤:
- 在页面中包含“https://export.dhtmlx.com/gantt/api.js”文件以启用在线导出服务:
<script src="codebase/dhtmlxgantt.js">&l