word转换---docx转pdf,【node】docx-pdf、LibreOffice,office-to-pdf【python】Win32com、python-docx

提示:node版本18.18.1 ,python版本3.11.5

前言

word预览

在这里插入图片描述

项目结构预览
在这里插入图片描述

一、docx-pdf【node】

npm docx-pdf -S-D

index.js

const express = require('express');
const app = express();
app.listen(3000,()=>{
   
   
    console.log('http://localhost:3000');
});

const converter = require('docx-pdf');

const ConvertDocToPdf = async (inputPath, outputPath) => {
   
   
    
    converter(inputPath, outputPath, (err, result) => {
   
   
        if (err) {
   
   
            console.error('PDF转换失败:', err);
            return;
        }
        console.log('PDF转换成功:', result);
    })
}
// 注意这种方式转换,outputPath是文件,需要写到具体文件
ConvertDocToPdf('./source/test2.docx','./source/test2.pdf')

在这里插入图片描述
在这里插入图片描述
转换成功了,但是不支持.docx文件的表格转换

二、安装依赖应用程序–LibreOffice

libreoffice官网
1、安装

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值