@danyded
It seems you are using some custom fonts in DOCX to PDF conversion those are not available on our server. Please note when you convert Microsoft Word to PDF in Node.js with embedded fonts using GroupDocs.Converter Cloud API, you need to upload your custom fonts to a folder in the cloud storage and pass the folder path in the FontPath parameter.
You may follow these simple steps to convert Word to PDF without changing font in Node.js with GroupDocs.Converter Cloud API.
Steps to Convert Microsoft Word to PDF with Custom Fonts in Node.js
-
Sign up with groupdocs.cloud and get the credentials
- Install GroupDocs.Conversion Cloud SDK for Node.js from NPM
- Create a script file for Node.js code
- Load the GroupDocs.Conversion Cloud SDK for Node.js module
- Upload your input DOCX file to cloud storage
- Upload your custom fonts to a cloud folder
- Initialize ConvertAPI with your credentials
- Create a ConvertSettings object and set the required parameters along with fontsPath parameter. Set it with the cloud folder path
- Create ConvertDocumentRequest object with the ConvertSettings
- Finally, call the convertDocument API method to convert the output PDF document on Cloud Storage with embedded fonts
Code to Convert Microsoft Word to PDF with Custom Fonts in Node.js
// load the module
var GroupDocs = require('groupdocs-conversion-cloud');
// get your clientId and clientSecret at https://dashboard.groupdocs.cloud (free registration is required).
var clientId = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx";
var clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxx";
// convert DOCX to PDF with custom fonts
const convert = async () => {
const convertApi = GroupDocs.ConvertApi.fromKeys(clientId, clientSecret);
const settings = new GroupDocs.ConvertSettings();
settings.filePath = "02_pages.docx";
settings.format = "pdf";
settings.outputPath = "02_pages.pdf";
settings.fontsPath = "font/ttf";
try {
const request = new GroupDocs.ConvertDocumentRequest(settings);
await convertApi.convertDocument(request);
} catch (err) {
throw err;
}
}
convert()
.then(() => {
console.log("document converted successfully");
})
.catch((err) => {
console.log("Error occurred while converting the document:", err);
})
Hopefully, it will help you to accomplish the task and feel free to contact us for any assistance in this regard.