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

Free Support Forum - aspose.com

Aspose.Task save to PDF rendering issue

Hi,

We are currently evaluating Aspose.Tasks and are facing difficulites with the pdf rendering of a mpp file.

We use Aspose.Task for java and need to load and save an existing mpp file to pdf with the same rendering (for example : fit to one page).

How can we achieve this whit Apose.Task for java ? Can you please provide sample code ?

Please find in attachment the mpp file we want to save in pdf format, the print preview from MS-Project to show the expected result and the current PDF result.

Thanks.

mpp file : pce_exported_projet.zip (20.6 KB)
schreenshot of expected result (from MS-Project) : MS-Project print preview.png (59.9 KB)
current result (not as expected) : pce_exported_projet.pdf (161.7 KB)

@antoinegentet

Can you please share which API version you are using along with sample code so that I may observe that on my end to assist you further.

@mudassir.fayyaz,

thank you for your answer. We use Aspose.Task for java version 20.10. Here is sample code we use to load and save an mpp project file to pdf :

public class EvaluateAsposeTask {

    public static void main(String[] args) {
        try {
            loadAsposeLicense();
            Project prj = new Project("./pce_exported_projet.mpp");
            PdfSaveOptions savePdfOptions = new PdfSaveOptions();
            savePdfOptions.setPresentationFormat(PresentationFormat.GanttChart);
            savePdfOptions.setFitContent(true);
            savePdfOptions.setStartDate(prj.get(Prj.START_DATE));
            savePdfOptions.setEndDate(prj.get(Prj.FINISH_DATE));            
            prj.save("./pce_exported_projet_01.pdf", savePdfOptions);
        } catch (IOException ex) {
            Logger.getLogger(EvaluateAsposeTask.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

Thank you for your help.

@antoinegentet

We need to investigate this on our end and a ticket with ID TASKSJAVA-1291 has been added in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@mudassir.fayyaz
Thanks. Keep me posted.
Have a good day.

@antoinegentet

Sure, we will apprise you as soon as the issue will be addressed.

@mudassir.fayyaz Good morning. Do you have any update about ticket TASKSJAVA-1291 ? Can you please give me a resolution delay ?

@antoinegentet

I regret to share that issue is still unresolved. We request for your patience and will share good news with you as soon as it will be fixed.

@mudassir.fayyaz Good morning. Do you have any update about ticket TASKSJAVA-1291 ? Can you please give me a resolution delay ? We have bought Aspose.Total License and we really need this ticket to be fixed to go ahead in our project.

@antoinegentet

The concerned issue is going to be fixed in upcoming Aspose.Tasks for Java 21.2. We request for your patience and will share the good news with you as soon as it will be shared online.

@mudassir.fayyaz Good morning. I’ve seen that ticket TASKSJAVA-1291 was resolved. Thank you for that.
I have downloaded the new release Aspose.Tasks for Java 21.2, but the issue is not fixed. I’m still not able to have the same rendering in pdf for fit to one page. Any Idea ?

Have a good day.

@antoinegentet Hello!
We added a new option for export to graphical formats. Please, try the next code sample:

    Project project1 = new Project("pce_exported_projet.mpp");
    PdfSaveOptions saveOptions = new PdfSaveOptions();
    saveOptions.setTimescale(Timescale.Days);
    saveOptions.setPresentationFormat(PresentationFormat.GanttChart);
    // set the option to render on a single page
    saveOptions.setRenderToSinglePage(true);
    saveOptions.setStartDate(project1.get(Prj.START_DATE));
    saveOptions.setEndDate(project1.get(Prj.FINISH_DATE));
    project1.save("output.pdf", saveOptions);

Good Morning @alexanderefremov1,

thank you for your answer.
It works fine with your code sample.

Thanks for your support.
Have a good day,

Hi @alexanderefremov1,

fit to one page works fine, but we have the following questions about pdf rendering :

  1. How can we define the redering on max X pages vertically and max Y pages horizontally ?
    For example, for a project of one month duration with a lot of tasks, I want to set max 1 page horizontally, and max 5 pages vertically. Or for a long duration project with few tasks, I want to set max 2 pages vertically and max 6 pages horizontally.

  2. How can the tasks’ bar color be rendered in PDF ?
    For example, we have defined some colors on tasks’ bar (see MS-Project print preview.png), but these colors are not rendered on the PDF.

Thank you for your support.
Antoine Gentet.

@antoinegentet

I have associated the information in our issue tracking system and will get back to you with feedback as soon as the issue will be addressed.

@mudassir.fayyaz

Thank you. I appreciate your support.

A ticket with ID TASKSNET-4759 has been created in our issue tracking system to address this issue.

A ticket with ID TASKSNET-4760 has been created in our issue tracking system to address this issue.

@mudassir.fayyaz

Thank you. Just to be sure: as we mentionned earlier we use Aspose.Tasks for java. I just want to confirm that both issues will be fixed also for Aspose.Tasks for java ? Because both tickets are named TASKSNET-0000 and not TASKSJAVA-0000.

Aspose.Tasks for Java is a ported version of Aspose.Tasks for .NET, so we are trying to resolve the issues for .NET version at first. If we find the issues we would port it in the next Aspose.Tasks for Java version.

@antoinegentet

Can you please try using latest Aspose.Tasks for Java 21.3 on your end for issue pertaining to fixing of tasks bar styles in case of non-default name of Gantt chart view.