Have ideas to improve npm?Join in the discussion! »

    zapoj-office-to-pdf

    1.0.1 • Public • Published

    zapoj-office-to-pdf

    Works with specified soffice path and converts to pdf.

    libreoffice required. Test if the command 'soffice' is available in your project.

    Example:

    var toPdf = require("zapoj-office-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 'zapoj-office-to-pdf'
    
    var pdfBuffer = await toPdf(wordBuffer)
    
    

    as you see toPdf just returns a promised pdf file

    Install

    npm i zapoj-office-to-pdf

    DownloadsWeekly Downloads

    31

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    14.4 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar