Coder Social home page Coder Social logo

lambda_svg_png's Introduction

SVG to PDF S3 Lambda converter

Lambda function that waits for SVG files uploaded to S3, converts them to PDF using rsvg-convert (librsvg and cairo) and uploads back to S3.

This example shows how to wire up S3 file conversion that runs an external processor, in this case rsvg-convert. This example project uses a pre-built binary version of rsvg-convert for AWS Lambda.

Prerequisites

  • create a S3 bucket for file uploads

Setting up the converter

  1. run npm install to fetch the dependencies
  2. run npm start to deploy the initial lambda version
  3. modify the package.json connect script to use your bucket name
  4. run npm run connect to configure your S3 bucket to invoke the lambda function when a new file is uploaded to the /in directory

Try it out

Once you've installed everything, send a test SVG file to your bucket using the S3 console, or the AWS CLI tools. The command lines below assume the bucket is called test-svg-bucket, so adjust the commands for your bucket name accordingly.

aws s3 cp example.svg s3://test-svg-bucket/in/example.svg

Wait a few seconds, and then check if the /out folder of your S3 bucket

aws s3 ls s3://test-svg-bucket/out/

Download the file with the same base name, but the pdf extension, from the /out folder:

aws s3 cp s3://test-svg-bucket/out/example.pdf .

lambda_svg_png's People

Contributors

sagannotcarl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.