AsposePSConvertType1FontToTTF

AsposePSConvertType1FontToTTF function

Converts PostScript Type 1 fonts to TrueType (TTF) and saves the generated font files in the specified directory in the file system.

function AsposePSConvertType1FontToTTF(
    fileName,
    outputDir
)
ParameterTypeDescription
fileNamestringSource font file name.
outputDirstringDirectory for the generated TTF files in the in-memory file system. Create it with FS.mkdirTree before conversion.

Return Value

JSON object.

FieldDescription
errorCodeError code (0 indicates success).
errorTextError message (empty on success).
outputDirDirectory containing the generated TTF font files.

Examples

Run the following code after the library has initialized. DownloadFile is provided by AsposePageforJS.js and reads each font from the in-memory file system.

const AsposePage = require('asposepagenodejs');

const ps1_file = "./data/freeeuro.pfa";

console.log("Aspose.Page for Node.js via C++ examples.");


AsposePage().then(AsposePageModule => {

    let json = AsposePageModule.AsposePageAbout();
    console.log("AsposePageAbout => %O",  json.errorCode == 0 ? JSON.parse(JSON.stringify(json).replace('"errorCode":0,"errorText":"",','')) : "error:" + json.errorText);

    json = AsposePageModule.AsposePSConvertType1FontToTTF(ps1_file, './data/');
    console.log("AsposePSConvertType1FontToTTF => %O",  json.errorCode == 0 ? JSON.parse(JSON.stringify(json).replace('"errorCode":0,"errorText":"",','')) : json.errorText);
},
    reason => {console.log(`The unknown error has occurred: ${reason}`);}
);

See Also