Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert DOC to PDF using Node.js
This Gist contains code snippets related to conversion of DOC file to PDF using Aspose.Words Cloud SDK for Node.js
const { WordsApi, GetDocumentWithFormatRequest } = require("asposewordscloud");
// Get clientId and clientSecret from
const clientId = "718e4235-8866-4ebe-bff4-f5a14a4b6466";
const secret = "388e864b819d8b067a8b1cb625a2ea8e";
// create an instance of WordsApi
const wordsApi = new WordsApi(clientId, secret);
// Convert Word Document to PDF (the output will be saved in Cloud storage)
var fileName = "GetStyles.doc";
// start of try catch bloack
try {
var request = new GetDocumentWithFormatRequest ({
// name of input doc file
name : fileName,
// format of resultant file
format: "pdf",
// name of resultant file on CloudStorage
outPath : "Converted.pdf"
// initialize the document conversion operatoin
wordsApi.getDocumentWithFormat(request).then(() => {
// print success message on console
console.log("Successfully converted..");
catch (e) {
console.log("entering catch block");
console.log("leaving catch block");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment