Docker image-based AWS Lambda function in Node.js that converts any document format that LibreOffice can import into any document format that LibreOffice can export, and a thumbnail image.
based on javidlakha/unofuction.
Artwork by brazilianferalcat
- Create a new repositery
- Go to view push commands
- Follow the steps mentioned in the pop-up
- After deploying the image to ECR, set up a new container image Lambda function by providing the latest uploaded ECR Container Image URL from the previous steps
Check out this detailed and very easy to follow article for step by step tutorial!
- Ensure Docker is installed on your system.
- Building the image
docker build -t pdf-genie:latest .
2(a). Running the image (x86_64)
docker run -p 9000:8080 pdf-genie:latest
2(b). Running the image (Mac M1-M2)
docker run --platform linux/amd64 -p 9000:8080 pdf-genie:latest
- Locally running at
http://localhost:9000/2015-03-31/functions/function/invocations
for more details - AWS Docs.
Regular Event,
{
"media_url": "<YOUR-MEDIA-URL>",
"convert_to": "pdf OR <ANY-OTHER-SUPPORTED-FORMAT>"
}
If routed through AWS API Gateway,
{
"headers": {
"Authorization": "Bearer <USER_TOKEN>"
},
"body": <JSON_STRINGIFIED_REGULAR_EVENT> (Available above)
}
- Libreoffice
- Poppler-Utils (incl. pdfinfo, pdftocairo etc.. )