Skip to content

alfredo/imprenta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published