AsposeFontConvertToSvg | Soluzione API per node.js

Come convertire i caratteri in formato SVG usando Aspose.Font per node.js?

  1. Chiama AsposeFontConvertToSvg.
  2. Il file di nome risultante è impostato, in json.filenameresult.
  3. Quindi, se json.errorcode è 0, è possibile ottenere collegamenti ai file di risultato. Se il parametro json.errorcode non è uguale a 0 e, di conseguenza, ci sarà un errore nel tuo file, le informazioni su tale errore saranno contenute nel json.errortext.

Di seguito è riportato l’esempio che converte il font dal formato TTF al formato 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    });

*Sostituisci il path/to/your/font.ttf con il percorso effettivo del file font.

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.