Skip to content

cedced19/custom-soffice-to-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custom-soffice-to-pdf

Inspired from @janek26's office-to-pdf package.

LibreOffice required and more specifically soffice. Test if the command soffice is available in your console or specify the command to run.

Example:

var toPdf = require("custom-soffice-to-pdf")
var fs = require("fs")
var wordBuffer = fs.readFileSync("./test.docx")

toPdf(wordBuffer).then(
  (pdfBuffer) => {
    fs.writeFileSync("./test.pdf", pdfBuffer)
  }, (err) => {
    console.log(err)
  }
)

in Node >v7 you can do (very pretty):

import toPdf from 'custom-soffice-to-pdf'

var pdfBuffer = await toPdf(wordBuffer)

as you see toPdf just returns a promise

Specify which command to use:

Just pass another argument with the command to run instead of soffice

import toPdf from 'custom-soffice-to-pdf'

var pdfBuffer = await toPdf(wordBuffer, '"C:\\Program Files\\LibreOffice\\program\\soffice"')

About

Inspired from @janek26 'office-to-pdf' package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published