ArgumentException: FontFamily Arial not found on saving MPP as PDF on Linux (Java)

I have attempted to update to the latest version of Apose.Tasks for Java (from version 19.5 to version 19.9)

I have not changes my code, only subtituted the jar file

My tests now fail against a sample set of 18 mmp files with errors along the lines of:

''com.Aspose.tasks.private_.Exceptions.ArgumentException: FontFamil ‘Arial’ not found.

Is this an expected change? I can’t see any mention of this in the release note.

@rcpeate,

Can you please share source file along with sample code and generated result so that we may further investigate to help you out.

You should be able to reproduce the issue with:

Project doc = new Project(new FileInputStream(new File("test.mpp"))), new LoadOptions());
PdfSaveOptions saveOps = new PdfSaveOptions();
doc.save(new FileOutputStream(new File("tmp.pdf"), saveOps);

And the file from here: https://ablesim.com/wp-content/uploads/2016/06/35-levels.mpp

@rcpeate,

I have worked with source file and sample code and unable to observe any issue. I have also shared my generated result with you for your kind reference. Can you please check attachment. Also please share complete environment details with us.tmp.pdf (150.8 KB)

Could it be that on your test system you have the fonts, whereas I don’t?

For clarity this is a Linux system running Java 1.8.0_191.

I expect that the error message is ‘correct’ and that some other configuration may be required (perhaps for this version an explicit fallback strategy needs to be configured, or default enabled?) . what is not expected is the change in behaviour cause by simply swapping the jar version.

@rcpeate,

Can you please check this code if it is useful for you. I regret to inform that we do not support loading fonts externally and because Arial is a proprietary font by Microsoft and it is not installed on Linux by default thats why you are facing this issue.

Project project = new Project(Paths.NEW_PROJECT_2007);
GanttChartView view = (GanttChartView) project.getViews().getByIndex(0);
TableTextStyle style = new TableTextStyle(1);
style.setBackgroundColor(java.awt.Color.GRAY);
style.setColor(java.awt.Color.RED);
style.setField(Field.TaskName);
style.setFontStyle(FontStyle.Bold | FontStyle.Italic);
view.getTableTextStyles().add(style);
project.save(this.getTempFile(), SaveOptions);

Thank you for the reply, but no that hasn’t worked.

I think this misses the main point in that this did work satisfactorily for an older version (was there some data loss that was not aware of), so from my perspective this is a regression in the capability of the library?

@rcpeate,

Can you please share in which old version everything was working fine on your end.

Version 19.5 using the exact same code.

@rcpeate,

I have observed the feedback shared by you and an issue with ID TASKSJAVA-999 has been created 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.

The issues you have found earlier (filed as TASKSJAVA-999) have been fixed in this update.