All Projects → shelfio → Aws Lambda Libreoffice

shelfio / Aws Lambda Libreoffice

Licence: mit
85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Aws Lambda Libreoffice

Serverless Libreoffice
Run LibreOffice in AWS Lambda to create PDFs & convert documents
Stars: ✭ 410 (+182.76%)
Mutual labels:  libreoffice, serverless, aws-lambda, pdf-converter
A Crash Course On Serverless Auth
A short and easy boilerplate showcasing JWT auth with Nodejs, the Serverless framework, MongoDB and AWS Lambda.
Stars: ✭ 127 (-12.41%)
Mutual labels:  serverless, aws-lambda
Landsat Tiler
A serverless Landsat tiles server using AWS Lambda
Stars: ✭ 126 (-13.1%)
Mutual labels:  serverless, aws-lambda
Doctron
Docker-powered html convert to pdf(html2pdf), html to image(html2image like jpeg,png),which using chrome(golang) kernel, add watermarks to pdf, convert pdf to images etc.
Stars: ✭ 141 (-2.76%)
Mutual labels:  pdf-generation, pdf-converter
Architect
The simplest, most powerful way to build serverless applications
Stars: ✭ 1,925 (+1227.59%)
Mutual labels:  serverless, aws-lambda
Fx
A Function as a Service tool makes a function as a container-based service in seconds.
Stars: ✭ 1,679 (+1057.93%)
Mutual labels:  serverless, aws-lambda
Aws Lambda Scala
Writing AWS Lambdas in Scala
Stars: ✭ 135 (-6.9%)
Mutual labels:  serverless, aws-lambda
Serverless Plugin Optimize
Bundle with Browserify, transpile and minify with Babel automatically to your NodeJS runtime compatible JavaScript
Stars: ✭ 122 (-15.86%)
Mutual labels:  serverless, aws-lambda
Spark On Lambda
Apache Spark on AWS Lambda
Stars: ✭ 137 (-5.52%)
Mutual labels:  serverless, aws-lambda
Shadowreader
Serverless load testing for replaying website traffic. Powered by AWS Lambda.
Stars: ✭ 138 (-4.83%)
Mutual labels:  serverless, aws-lambda
Serverless Pg
A package for managing PostgreSQL connections at SERVERLESS scale
Stars: ✭ 142 (-2.07%)
Mutual labels:  serverless, aws-lambda
Ptext Release
pText is a library for reading, creating and manipulating PDF files in python.
Stars: ✭ 124 (-14.48%)
Mutual labels:  pdf-generation, pdf-converter
Iopipe Js Core
Observe and develop serverless apps with confidence on AWS Lambda with Tracing, Metrics, Profiling, Monitoring, and more.
Stars: ✭ 123 (-15.17%)
Mutual labels:  serverless, aws-lambda
Etherpad Lite
Etherpad: A modern really-real-time collaborative document editor.
Stars: ✭ 11,937 (+8132.41%)
Mutual labels:  libreoffice, pdf-generation
Serverless
Serverless 架构应用开发指南 - Serverless Architecture Application Development Guide with Serverless Framework.
Stars: ✭ 1,616 (+1014.48%)
Mutual labels:  serverless, aws-lambda
Aws Lambda List
A list of hopefully useful AWS lambdas and lambda-related resources.
Stars: ✭ 130 (-10.34%)
Mutual labels:  serverless, aws-lambda
Portkey
Live-coding the Cloud
Stars: ✭ 139 (-4.14%)
Mutual labels:  serverless, aws-lambda
Serverless Architectures Aws
The code repository for the Serverless Architectures on AWS book
Stars: ✭ 120 (-17.24%)
Mutual labels:  serverless, aws-lambda
Aws Lambda R Runtime
Serverless execution of R code on AWS Lambda
Stars: ✭ 121 (-16.55%)
Mutual labels:  serverless, aws-lambda
Cra Serverless
Serverless pre-rendering (SSR) for React SPA using AWS Lambda, S3, and CloudFront.
Stars: ✭ 137 (-5.52%)
Mutual labels:  serverless, aws-lambda

aws-lambda-libreoffice

85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli

Inspired by chrome-aws-lambda

ℹ️ Compiled LibreOffice version: 6.4.0.1

Install

$ yarn add @shelf/aws-lambda-libreoffice

NOTE: Since version 2.0.0 npm package no longer ships the 85 MB LibreOffice but relies upon libreoffice-lambda-layer instead. Follow the instructions on how to add a lambda layer in that repo.

Usage

const {convertTo, canBeConvertedToPDF} = require('@shelf/aws-lambda-libreoffice');

module.exports.handler = async () => {
  // assuming there is a document.docx file inside /tmp dir
  // original file will be deleted afterwards

  if (!canBeConvertedToPDF('document.docx')) {
    return false;
  }

  return convertTo('document.docx', 'pdf'); // returns /tmp/document.pdf
};

Or if you want more control:

const {unpack, defaultArgs} = require('@shelf/aws-lambda-libreoffice');

await unpack(); // default path /tmp/instdir/program/soffice.bin

execSync(
  `/tmp/instdir/program/soffice.bin ${defaultArgs.join(
    ' '
  )} --convert-to pdf file.docx --outdir /tmp`
);

Troubleshooting

  • Please allocate at least 1536 MB of RAM for your Lambda function.
  • It works only in Amazon Linux 2, so it won't work locally on Linux or macOS. However, you could run it in Docker using lambci/lambda:nodejs12.x image
  • If some file fails to be converted to PDF, try converting it to PDF on your computer first. This might be an issue with LibreOffice itself

See Also

Test

Smoke test that it works: ./test.sh. Make sure to clone libreoffice-lambda-layer repo alongside

Publish

$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master

License

MIT © Shelf

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].