GithubHelp home page GithubHelp logo

tportela1 / imprenta Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alfredo/imprenta

0.0 1.0 0.0 9 KB

An AWS lambda in python 3 that generates PDF files from HTML using jinja, pdfkit and wkhtmltopdf.

Makefile 3.77% Python 62.89% Shell 33.34%

imprenta's Introduction

Imprenta

An AWS lambda that generates PDF files from HTML using pdfkit and wkhtmltopdf.

This package will:

  • Read context variables from the API payload.
  • Render context varialbes with the vendor/templates/base.html.
  • Pass the rendered HTML to wkhtmltopdf to generate the PDF
  • Upload the PDF file to S3.
  • Return a signed URL of the PDF and the key.

This package is not feature complete. It is intended to be the starting point for a PDF generator as the HTML template will need to be coded, the context variables handled and authentication added.

Chalice microframework is used to do the aws configuration heavylifting.

Requirements

  • Docker
  • virtualenv (recommended).
  • GNU make
  • awscli python package installed and configured.

Bootstrapping

A bootstrap script has been created for convenience. Make sure the project virtualenv is activated before running this command.

$ make build

This command will:

  • Download and install wkhtmltopdf
  • Build docker and install amazon-linux specific dependencies.
  • Install package dependencies in the active python environment.
  • Prepare the chalice initial configuration.

After this command has been run the environment variables in pdf/.chalice/conf.json must be added. These AWS credentials must match the

Deploy

A command has been created to deploy the application

$ make deploy

Running it local

The lambda can be run locally, but the wkhtmltopdf binary won't run since it is using the linux binary at the moment.

$ make local

imprenta's People

Contributors

alfredo avatar piotrplenik avatar ryankask 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.