1.0.2 • Published 2 years ago

libreoffice-to-pdf v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装

npm i libreoffice-to-pdf --save

环境配置

依赖于插件libreoffice,请自行前往官网安装

这里说明一下,遇到的问题,linux环境下转换的文件出现乱码,需要将windows中文字库移到linux下可以解决

PS: 使用libreoffice转换前 ,一定要先启动libreoffice,否则会严重影响转换速度,甚至导致时间超时

使用

const topdf = require('libreoffice-to-pdf');
const fs = require('fs')
const path = require('path');

async function  a (){

    let data = fs.readFileSync('./1.xlsx')
    let buf = await topdf(data,{
        dirPath:path.join(__dirname,'public'),
        isSave:true
    })

}

a()

topdf的options配置参数有三个:

参数描述
dirPath文件路径,文件存储的目录
fileName文件名,不带后缀,不是路径
isSave中间文件是否保留
1.0.1 
    ---修复临时文件保存路径不合理问题
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago