AsposeFontConvertToWOFF

How to convert fonts into WOFF format using Aspose.Font for Node.js?

  1. Call AsposeFontConvertToWOFF function.
  2. The resulting name file is set, in json.fileNameResult.
  3. Next, if the json.errorCode is 0, then get links to result the files. If the json.errorCode parameter is not equal to 0 and, accordingly, there will be an error in your file, then information about such an error will be contained in the json.errorText.

Below is the sample which converts OTF font to WOFF format.

 1    const AsposeFont = require('asposefontnodejs');
 2
 3    const font_file = "./fonts/Montserrat-Regular.eot";
 4
 5    console.log('Aspose.Font for Node.js via C++ example');
 6
 7    AsposeFont().then(AsposeFontModule => {
 8        //call AsposeFontConvertToWOFF to convert font
 9        const json = AsposeFontModule.AsposeFontConvertToWOFF(font_file,AsposeFontModule.FontType.OTF);
10        console.log("AsposeFontConvertToWOFF : %O",  json.errorCode == 0 ? font_file + ' => ' + json.fileNameResult : json.errorText);
11    });

*Replace path/to/your/font.eot with the actual path to your font file.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.