We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Difference in pdf export (start/and date)

Hello, we moved from task version 7.2.0 to 8.0.0 but we got some inconvenience, probably related each one

this is our code for exportinf mpp files to pdf:

Aspose.Tasks.Saving.PdfSaveOptions OptionsT = new Aspose.Tasks.Saving.PdfSaveOptions();
//OptionsT.StartDate = ((Aspose.Tasks.Project)m_oDocument).StartDate;
//AddDays(-3);//OptionsT.EndDate = ((Aspose.Tasks.Project)m_oDocument).FinishDate;//per il pdf non esiste risoluzione
//OptionsT.HorizontalResolution = m_iResolution;
//OptionsT.VerticalResolution = m_iResolution;
OptionsT.MarkCriticalTasks = true;
OptionsT.LegendOnEachPage = true;
OptionsT.Gridlines = new List<Aspose.Tasks.Visualization.Gridline>();
Aspose.Tasks.Visualization.Gridline gridline = new Aspose.Tasks.Visualization.Gridline();
gridline.GridlineType = Aspose.Tasks.Visualization.GridlineType.GanttRow;
gridline.Color = System.Drawing.Color.CornflowerBlue;
gridline.Pattern = Aspose.Tasks.Visualization.LinePattern.Dashed;
OptionsT.Gridlines.Add(gridline);
//OptionsT.SaveToSeparateFiles = false;
//OptionsT.Pages = new List { ++_iPageIndex };
((Aspose.Tasks.Project)m_oDocument).Save(_oOutputStream, OptionsT);


1 as you can see we had to comment lines with startdate and finishdate because now there aren’t anymore: how can we change these lines?

2 resulting pdf is different now (see examples in attachment) from the same file saved as pdf with version 7.2.0
probably point 1 has a meaning with point 2 too

Hi Valerio,

Thank you for sharing your concern with us.

You are right! Aspose.Tasks for .NET 8.0.0 is a totally revamped API that has been re-written for providing more ease of use and better performance. You can go through the details of this new release from our blog post. In my opinion, the point 2 is related to the changes you have done to your code sample by commenting out the lines.

The new code sample as per the revamped API is as follow. Please note the usage of static class Prj that now contains all the properties related to the Project. You can use the Get and Set methods of the Project class to read/write these properties.You may consider visiting our online documentation for migration from legacy API to this new API. Please let us know if we can be of any additional help to you in this regard.

Sample Code:

Project project = new Project("test.mpp");

Aspose.Tasks.Saving.PdfSaveOptions OptionsT = new Aspose.Tasks.Saving.PdfSaveOptions();

OptionsT.StartDate = project.Get(Prj.StartDate).AddDays(-3);// ((Aspose.Tasks.Project)m_oDocument).StartDate;

//AddDays(-3);

OptionsT.EndDate = project.Get(Prj.FinishDate);// ((Aspose.Tasks.Project)m_oDocument).FinishDate;//per il pdf non esiste risoluzione

//OptionsT.HorizontalResolution = m_iResolution;

//OptionsT.VerticalResolution = m_iResolution;

OptionsT.MarkCriticalTasks = true;

OptionsT.LegendOnEachPage = true;

OptionsT.Gridlines = new List<Aspose.Tasks.Visualization.Gridline>();

Aspose.Tasks.Visualization.Gridline gridline = new Aspose.Tasks.Visualization.Gridline();

gridline.GridlineType = Aspose.Tasks.Visualization.GridlineType.GanttRow;

gridline.Color = System.Drawing.Color.CornflowerBlue;

gridline.Pattern = Aspose.Tasks.Visualization.LinePattern.Dashed;

OptionsT.Gridlines.Add(gridline);

//OptionsT.SaveToSeparateFiles = false;

//OptionsT.Pages = new List { ++_iPageIndex };

project.Save("test AT.8.0.0.pdf", OptionsT);

Hi, we see this example in your online documentation but we can’t understand Prj.StartDate
what kind of class is “Prj”?
thank’s

Hi Valerio,


The Prj static class contains all the properties that were earlier associated with the Project class. These can be accessed using the Get and Set methods of the Project class. This helps the API to set other parameters while project properties are set. So, to access properties related to project, you need to use the appropriate property from the Prj class. Please let us know if we can be of any additional help to you in this regard.

Ok we got it, thanks a lot.

Hi Valerio,


We are glad to know that your issue is resolved and please feel free to write us back if you have any other query related to Aspose.Tasks.