We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PDF gantt export

Hi,

I've two questions about the pdf gannt export:

1. In my gantt, I use other colors.... how can I export my colours?

2. Can I fit the page to A3 paper?

Thanks

3 Replies

JS Jonesherine Stephen Syncfusion Team September 29, 2017 12:46 PM UTC

Hi Manolo, 
Thanks for contacting Syncfusion support 
Query1: In my gantt, I use other colors.... how can I export my colours? 
Solution: In Gantt we can customize the taskbar and parent taskbars by using “ParentTaskbarBackground, ParentProgressbarBackground, TaskbarBackground, ProgressbarBackground” properties. 
We have prepared the Gantt sample with customized taskbars and progress bars and also performed PDF exporting. 
Please find the code example below: 
@(Html.EJ().Gantt("GanttContainer") 
              //To Map the serverside exporting action              
             .Mappers(mp => mp.ExportToPdfAction("Gantt/ExportToPdf")) 
              //To customize Gantt Taskbars and Progress bar 
             .ParentTaskbarBackground("#56bc0d") 
             .ParentProgressbarBackground("#933969") 
             .TaskbarBackground("#a4b9db") 
             .ProgressbarBackground("#2f87c6")              
             .ToolbarSettings(tool => 
              { 
                  tool.ShowToolbar(true); 
                  tool.ToolbarItems(new List<GanttToolBarItems>() 
                 { 
                      GanttToolBarItems.PdfExport, 
                 }); 
              }))@(Html.EJ().ScriptManager()) 
Query 2: Can I fit the page to A3 paper? 
Solution: We can customize the size and orientation of the PDF document using PageSettings and PageOrientation properties. 
Please find the code example below: 
public void ExportToPdf(string GanttModel) 
        { 
            PdfExport exp = new PdfExport(); 
            PdfDocument document = new PdfDocument(); 
            document.PageSettings.Height = 1587; 
            document.PageSettings.Width = 1123; 
            var DataSource = this.GetEditingDataSource(); 
            GanttProperties obj = ConvertGanttObject(GanttModel); 
            GanttPdfExportSettings settings = new GanttPdfExportSettings(); 
            settings.Theme = GanttExportTheme.FlatSaffron;            
            settings.PageOrientation = PdfPageOrientation.Portrait; 
            exp.Export(obj, (IEnumerable)DataSource, settings, "Gantt", document, true);              
        }      
We have also prepared the sample in v15.2.40 for your reference, please find the sample from below location. 
 
Disclaimer: We have removed bin and obj folder in the given sample for some security reasons, we must include Syncfusion.EJ, Syncfusion.EJ.MVC, Syncfusion.EJ.Export, Syncfusion.Linq.Base, Syncfusion.Pdf.Base,Syncfusion.Compression.Base dlls to perform exporting in Gantt control which is available in Essential Studio installed location.   
Regards, 
Jone sherine P S. 




MA Manolo October 2, 2017 10:53 AM UTC

Hi,

I set the colours in queryTaskbarInfo event, so, in function of status I set different colours.

So, I can't set the taskbarcolours in gantt properties




SR Suriyaprasanth Ravikumar Syncfusion Team October 3, 2017 12:20 PM UTC

Hi Manolo, 
 
In Gantt, currently there is no support to export the Gantt taskbar’s with customized color’s on queryTaskbarInfo client side event. For this we have logged a feature report as “QueryTaskbarInfo event support for Gantt PDF export” and it will be implemented and included in our upcoming Volume 1, 2018 main release which will be expected to out at end of January, 2018.  
By using this support we can do same customization for each taskbar’s done in “queryTaskbarInfo” client side event. 
 
Please let us know if require further assistance on this. 
 
Thanks, 
Suriyaprasanth R. 


Loader.
Up arrow icon