使用npm / node模块或代码将PDF转换为doc或docx格式?

时间:2017-11-15 08:15:43

标签: node.js npm

我没有成功找到一个节点模块或一些可以使用Node JS将PDF转换为doc / docx格式的代码。有什么办法吗?

2 个答案:

答案 0 :(得分:1)

您可以使用Aspose.Words Cloud SDK for Node.jsnpm的PDF转换为DOCX

const { WordsApi, SaveOptionsData } = require("asposewordscloud");
const { UploadFileRequest, SaveAsRequest }= require("asposewordscloud/dist/model/model");
var fs = require('fs');

# Please get your App Key and App SID from https://dashboard.aspose.cloud
wordsApi = new WordsApi("APP_KEY", "APP_SID");

const remotename = "02_pages.pdf";
const remoteTempFolder = "Temp";

const request = new SaveAsRequest({
                        saveOptionsData: new SaveOptionsData({
                            saveFormat: "docx",
                            fileName: "TestPostDocumentSavePdfAsDocx.docx",
                        }),

                    });
                    request.name = remotename;
                    request.folder = remoteTempFolder;

wordsApi.saveAs(request).then((result) => {    
    console.log(result.body);    
}).catch(function(err) {
    // Deal with an error
    console.log(err);
});

我是aspose的开发人员。

答案 1 :(得分:0)

<强>节点unoconv

用于使用unoconv。

转换文档的node.js包装器

https://github.com/gfloyd/node-unoconv