AsposeFontConvertToSvg | Soluzione API per node.js
Contents
[
Hide
Show
]Come convertire i caratteri in formato SVG usando Aspose.Font per node.js?
- Chiama AsposeFontConvertToSvg.
- Il file di nome risultante è impostato, in
json.filenameresult
. - Quindi, se
json.errorcode
è 0, è possibile ottenere collegamenti ai file di risultato. Se il parametrojson.errorcode
non è uguale a 0 e, di conseguenza, ci sarà un errore nel tuo file, le informazioni su tale errore saranno contenute neljson.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.