Table of Contents

TMS FNC Gantt Chart PDF IO — Guides

TTMSFNCGanttChartPDFIO exports a Gantt chart to a PDF document. You assign the chart, choose what to include (task list, timeline, or both) and which task-list columns appear, set page options, then call Save. Use it to produce a portable, printable record of a schedule — a status report, a hand-out, or an archived plan. This guide covers a complete export, the export options, and controlling page breaks.

Exporting to PDF

Assign GanttChart, configure GanttChartPDFExportOptions, set page Options, and call Save with a target path. The call is synchronous:

procedure TForm1.ExportToPDF;
begin
  GanttChartPDFIO1.GanttChart := GanttChart1;

  // Export the task list, the timeline, or both.
  GanttChartPDFIO1.GanttChartPDFExportOptions.Mode := emBoth;

  // Choose the task-list columns and their widths.
  GanttChartPDFIO1.GanttChartPDFExportOptions.TaskListColumns.Clear;
  GanttChartPDFIO1.GanttChartPDFExportOptions.TaskListColumns.AddColumn('wbs', 'WBS', 80, 60);
  GanttChartPDFIO1.GanttChartPDFExportOptions.TaskListColumns.AddColumn('taskname', 'Task', 160, 120);
  GanttChartPDFIO1.GanttChartPDFExportOptions.TaskListColumns.AddColumn('startdate', 'Start', 90, 70);
  GanttChartPDFIO1.GanttChartPDFExportOptions.TaskListColumns.AddColumn('duration', 'Duration', 90, 70);

  // Fit the timeline to the page and repeat headers on every page.
  GanttChartPDFIO1.GanttChartPDFExportOptions.FitToPage := True;
  GanttChartPDFIO1.GanttChartPDFExportOptions.RepeatHeaders := True;

  GanttChartPDFIO1.Options.PageOrientation := poLandscape;
  GanttChartPDFIO1.Options.OpenInPDFReader := True;

  GanttChartPDFIO1.Save('project.pdf');
end;

Export options

GanttChartPDFExportOptions (a TTMSFNCGanttChartExportOptions) controls what is rendered:

Member Effect
Mode emBoth, emTaskList, or emTimeline — which areas are exported
TaskListColumns The columns to print; build with AddColumn(field, header, width, minWidth)
FitToPage Scale the timeline to fit the page width
RepeatHeaders Repeat the task-list and timeline headers on every page
TimelineUnitWidth / TimelineGroupHeight Timeline sizing
ItemHeight Row height in the export
UseCustomTaskListAppearance / UseCustomTimeLineAppearance Apply export-specific appearance instead of the chart's

Page-level settings live on Options (TTMSFNCPDFIO): PageOrientation (poPortrait / poLandscape), Margins, and OpenInPDFReader to launch the result after saving.

Valid TaskListColumns.AddColumn field identifiers include wbs, taskname, description, startdate, enddate, duration, and dependencies.

Controlling page breaks

For long task lists, OnRowIsPageBreak lets you decide where a new page starts — for example to keep groups together or cap rows per page:

procedure TForm1.GanttChartPDFIO1RowIsPageBreak(Sender: TObject;
  AExportObject: TTMSFNCPDFIOExportObject; ARow: Integer; var IsPageBreak: Boolean);
begin
  // Start a new page every 25 rows.
  IsPageBreak := (ARow > 0) and (ARow mod 25 = 0);
end;

Pitfalls

  • Assign GanttChart before calling Save, or the export raises "Gantt Chart Not Assigned".
  • TaskListColumns is only used when Mode includes the task list (emTaskList or emBoth); it has no effect in emTimeline.
  • Save is synchronous and overwrites the target file without prompting.
  • PDF export depends on the TMS FNC Core PDF library being installed.

See also