AsposefontConvertTosvg | node.js的API解决方案

如何使用node.js使用aspose.font将字体转换为SVG格式?

  1. 调用 AsposeFontConvertTosvg函数。
  2. json.filenameresult中设置了结果名称文件。
  3. 接下来,如果“ JSON.ERRORCODE”为0,则可以获取结果文件的链接。如果“ JSON.ERRORCODE”参数不等于0,因此您的文件中会有错误,则有关此类错误的信息将包含在json.erortext中。

以下是将字体从ttf转换为woff格式的示例。

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

*将路径/您/font.ttf替换为字体文件的实际路径。

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.