Giter Site home page Giter Site logo

zeplin-html-to-pdf's Introduction

Zeplin HTML to PDF Lambda

This is an AWS Lambda function that converts HTML pages to PDF documents using wkhtmltopdf (0.12.4), it implements a simple interface to read and HTML input and output PDF content.

WARNING: You must use v2.x.x tag if you are using Node.js runtime >=10.x in AWS Lambda.

Input

Input event to this function has the following structure:

{
    "html": "<!DOCTYPE html><html><head><title>HTML doc</title></head><body>Content<body></html>"
}

Output

It yields a response in the following format:

{
  "data": "JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7..."
}

data is base64 encoding of the converted PDF file.

Test in local environment

The function can be tested locally using AWS SAM CLI. You can change contents of events/example-event.json or you can create a new file which you will give sam as an event parameter.

sam local invoke "HtmlToPdf" -e events/example-event.json

Deploying to AWS

There are two ways in which these functions can be deployed to AWS.

1 - Check our npm run deploy:dev and npm run deploy:prod commands in package.json and change it according to your needs. Do not forget to add environment variables (you can find it under template.yml) to your lambda function in aws lambda edit page or running lamba update-function-configuration command.

2 - Check out template.yml file and edit according to your needs then use sam deploy.

zeplin-html-to-pdf's People

Contributors

dirtybit avatar ceylanismail avatar dorukgunes avatar negomi avatar jameaghe avatar

Watchers

James Cloos 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.