Hi,
We are currently using Aspose Words Java 15.11 API in one of our components…
We want to migrate to latest Aspose Words Java library which is currently 16.12.
When we are migrating, we getting compilation errors in FontSettings code…
Below provided the sample code and corresponding compilation errors:
//// Code written with Aspose Words Java 15.11:
public static void main(String[] args) throws Exception {
License license = new License();
license.setLicense(“Aspose.Words.lic”);
// Font settings.
FontSourceBase[] fontSources = new FontSourceBase[] { new FolderFontSource("/Fonts", true) };
String missingFontName = “Font1”;
String[] fontsToSubstitute = new String[] { “NewFont1” };
// Setup font settings.
FontSettings.setFontsSources(fontSources);
String[] currentFontSubstitutes = FontSettings.getFontSubstitutes(missingFontName);
System.out.println("currentFontSubstitutes: " + currentFontSubstitutes);
FontSettings.setFontSubstitutes(missingFontName, fontsToSubstitute);
}
//// Errors for above code with Aspose Words Java 16.12:
- Error(33,21): non-static method setFontsSources(com.aspose.words.FontSourceBase[]) cannot be referenced from a static context
- Error(34,55): non-static method getFontSubstitutes(java.lang.String) cannot be referenced from a static context
- Error(36,21): non-static method setFontSubstitutes(java.lang.String,java.lang.String...) cannot be referenced from a static context
Earlier in 15.11 version, these methods are static methods in FontSettings class…
Now they no longer static methods…
How to migrate this code for 16.12?
Can you please provide the code changes that works for 16.12? with retaining the functionality.
Thanks,
-Satya