Skip to main content

Django library for invoking splat

Project description

splat

splat is simple aws lambda function that takes HTML/CSS/JS, invokes PrinceXML to render it and returns the resulting PDF in one of many ways.

It is intended to be a DIY docraptor of sorts.

Installation

Simply build the docker image, deploy it to AWS, then invoke the lambda with an event body JSON that performs the desired operation. For example: {"document_content": "<h1>Hello, World!</h1>"}

Ways of invoking splat

Input

Pass content in event: {"document_content": "<h1>Hello, World!</h1>"} Pass content via URL: {"doucment_url": "<h1>Hello, World!</h1>"}

Output

Returns PDF base64 encoded by default. To save to an s3 bucket (lambda requires permission): {"bucket_name": "<BUCKET>"} To save to a presigned url: {"presigned_url": "<URL>"}

Options

To enable Javascript: {"javascript": true}

PrinceXML License

splat will attempt to install a PrinceXML license file by default. Just drop your license.dat in the root directory before you build the docker container. The licence file is gitignored for your convenience. If you do not have a licence file, Prince will watermark your PDFs, and you can only use them non-commercially. See their license page for more information.

You can check the status of the licence by invoking the lambda with the {"check_license": true} option, and interpreting the response, you can use this to periodically check the status of the licence and raise an alert if it's about to expire, and to verify that your new licence has updated correctly.

Fonts

splat will add any fonts inside a fonts.zip file. Ensure the zip file contains a folder called fonts with all fonts inside. Simply drop into the root directory and build the docker container. The fonts.zip file is gitignored for your convenience. By default, prince comes with a small suite of liberation fonts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uptick_splat-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

uptick_splat-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file uptick_splat-0.1.0.tar.gz.

File metadata

  • Download URL: uptick_splat-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/21.3.0

File hashes

Hashes for uptick_splat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a1009ef1995768f2f66841d56d73d0757f7337d92e390a47df6ff41056f0817
MD5 087d6914636d555b56aa3cd887856da7
BLAKE2b-256 73d1e53057f1311dc5533edf490ae7782186d8f2d075f100948e1e708de28660

See more details on using hashes here.

File details

Details for the file uptick_splat-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uptick_splat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/21.3.0

File hashes

Hashes for uptick_splat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfe6d213d21792b2ab74e714678d766d0c0e36b85c75cbb6dd107c5357fbee99
MD5 b551de2c60416c2b90a683ef96ccb6ee
BLAKE2b-256 5c256e20aaf13a30f4990bda14d7c26a3fce0b87f6a4c7df2e6c9b67c017b5f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page