Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/audunru/aws-lambda-pdf


https://github.com/audunru/aws-lambda-pdf

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# AWS Lambda PDF

An AWS Lambda function that will accept HTML as its input and return a PDF.

## Installation

```sh
npm i aws-lambda-pdf
```

## Usage

We'll be using [Serverless](https://www.serverless.com/framework/docs/getting-started) to deploy the function, so make sure you set up AWS credentials first.

Create a [serverless.yml](example/serverless.yml) file in the same folder as your package.json where you installed `aws-lambda-pdf`, then run:

```
npx serverless deploy
```

## Test

This will produce a PDF with the text "Hello world" in it:

```sh
curl https://replace-with-your-url.execute-api.us-east-1.amazonaws.com/dev/pdf \
-H 'Content-Type: application/json' \
-H 'Accept: application/pdf' \
--data-raw $'{"html":"

Hello world

"}' \
--output hello-world.pdf
```

## Logging

[Live Tail in CloudWatch](https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logsV2:live-tail)