A serverless AWS Lambda function that converts HTML content to PDF documents. This service provides a simple and efficient way to generate PDFs from HTML input.
- HTML to PDF conversion using AWS Lambda
- Serverless architecture
- Scalable and cost-effective solution
- AWS Account
- AWS CLI installed
- Python (for local development)
- Configure AWS SSO:
aws configure sso-
Enter the following information when prompted:
- SSO start URL: [Your SSO Start URL]
- SSO Region: [Your SSO Region]
- SSO registration scopes: sso:account:access
-
Select your AWS account and role when prompted
-
Verify the login:
aws sts get-caller-identity- Clone the repository:
git clone https://github.com/yourusername/lambda-html-to-pdf.git
cd lambda-html-to-pdf- Copy and edit the .env.example into .env
ACCOUNT_ID=
REGION=ca-central-1 #aws region to deploy
PROFILE=AWS_PROFILE_NAME_OR_NICKNAME_ENTERED_WHEN_CONFIGURING_AWS_CLI
FUNCTION_NAME=htmlToPdf #name of the lambda function
ROLE_NAME=html-to-pdf-lambda-role #name of the role
REPO_NAME=html-to-pdf-lambda #name of the ecr repo
IMAGE_TAG=latest #usually no need to change- Deploy to AWS:
./deploy.shThe Lambda function can be invoked with the following payload structure:
{
"html": "<html><body>Your HTML content</body></html>",
}- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers.