Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/audunru/aws-lambda-pdf
https://github.com/audunru/aws-lambda-pdf
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/audunru/aws-lambda-pdf
- Owner: audunru
- License: mit
- Created: 2024-10-20T12:16:24.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-10-21T06:43:31.000Z (2 months ago)
- Last Synced: 2024-10-23T07:42:29.610Z (2 months ago)
- Language: TypeScript
- Size: 416 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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)