libreoffice-to-pdf

1.0.2 • Public • Published

安装

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 
    ---修复临时文件保存路径不合理问题

Readme

Keywords

Package Sidebar

Install

npm i libreoffice-to-pdf

Weekly Downloads

11

Version

1.0.2

License

ISC

Unpacked Size

13.2 kB

Total Files

5

Last publish

Collaborators

  • bin.li