PDF Label Cropper
Deployment
This creates a zip file structured for AWS Lambda deployment. The virtual environment steps are only required if the packages are updated.
python -m venv lambda_envsource ./lambda_env/bin/activatepip install pypdf pdfplumber
Note the location of installed packages with pip show pypdf and modify the following commands if necessary.
deactivatecd lambda_env/lib/python3.13/site-packages/zip -r ../../../../_deploy/pdf-crop.zip .cd ../../../../
At this point, the zip file only contains the packages. To add the custom code and the lambda function, run the following command from the project root. This is the same command used to update the custom code.
zip _deploy/pdf-crop.zip cropper.py lambda_function.py
Inspect zip contents with unzip -l _deploy/pdf-crop.zip
Update the lambda function with (make sure specify the credentials and region):
aws lambda update-function-code --function-name pdf-label-crop --zip-file fileb://_deploy/pdf-crop.zip
Description
Languages
Python
100%