{"id":28406419,"url":"https://github.com/hwclass/pdf-over-the-wire","last_synced_at":"2025-08-12T00:09:35.179Z","repository":{"id":276996404,"uuid":"930980558","full_name":"hwclass/pdf-over-the-wire","owner":"hwclass","description":"A demonstrational spike to simulate uploading pdf files into S3 via AWS Lambda and LocalStack","archived":false,"fork":false,"pushed_at":"2025-03-06T11:20:11.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T08:37:44.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hwclass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-11T14:29:07.000Z","updated_at":"2025-03-06T11:20:15.000Z","dependencies_parsed_at":"2025-02-11T15:41:39.825Z","dependency_job_id":"2d765547-b04b-4dc4-99c4-87269b15a858","html_url":"https://github.com/hwclass/pdf-over-the-wire","commit_stats":null,"previous_names":["hwclass/pdf-over-the-wire"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hwclass/pdf-over-the-wire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwclass%2Fpdf-over-the-wire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwclass%2Fpdf-over-the-wire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwclass%2Fpdf-over-the-wire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwclass%2Fpdf-over-the-wire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hwclass","download_url":"https://codeload.github.com/hwclass/pdf-over-the-wire/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwclass%2Fpdf-over-the-wire/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269976811,"owners_count":24506472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-01T22:11:16.407Z","updated_at":"2025-08-12T00:09:35.167Z","avatar_url":"https://github.com/hwclass.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PDF over the wire with Lambda and LocalStack\n\n## Aim of the Proof of Concept\n\nThis proof of concept demonstrates how to upload, store, and retrieve PDF files using AWS Lambda and LocalStack. The repository provides a local development environment that simulates AWS services, allowing for testing and development without incurring costs or needing an internet connection.\n\n## Prerequisites\n\nMake sure you have the following installed:\n\n- [Docker](https://docs.docker.com/get-docker/)\n- [AWS CLI](https://aws.amazon.com/cli/)\n- [LocalStack](https://localstack.cloud/docs/get-started/)\n\n## Commands\n\n### Start LocalStack\n\n```sh\ndocker run --rm -it -p 4566:4566 localstack/localstack\n```\n\n### Create the local S3 bucket (pdf-upload-bucket)\n\n```sh\naws --endpoint-url=http://localhost:4566 s3 mb s3://pdf-upload-bucket\n```\n\n### Build and run the API locally\n\n```sh\nsam build\nsam local start-api --debug\n```\n\n### Upload a test file to the local S3 bucket (pdf-upload-bucket)\n\n```sh\necho \"Hello LocalStack S3\" \u003e testfile.txt\naws --endpoint-url=http://localhost:4566 s3 cp testfile.txt s3://pdf-upload-bucket/\n```\n\n### List the files in the local S3 bucket (pdf-upload-bucket)\n\n```sh\naws --endpoint-url=http://localhost:4566 s3 ls s3://pdf-upload-bucket/\n```\n\n### Download PDF from the local S3 bucket (pdf-upload-bucket)\n\n```sh\naws s3 cp s3://pdf-upload-bucket/\u003cREQUEST-ID\u003e.pdf ./\u003cREQUEST-ID\u003e.pdf --endpoint-url=http://localhost:4566\nopen \u003cREQUEST-ID\u003e.pdf\n```\n\n### Test uploading the PDF to the local S3 bucket (pdf-upload-bucket)\n\n```sh\ncurl -X POST \"http://127.0.0.1:3000/upload\" \\\n     -H \"Content-Type: application/pdf\" \\\n     --data-binary \"@api/Test_Invoice.pdf\"\n```\n\n### Install diff-pdf\n\n```sh\nbrew install diff-pdf\n```\n\n### Compare the original PDF with the downloaded PDF\n\n```sh\ndiff-pdf api/Test_Invoice.pdf api/9fa9f0f2-eb3d-44fe-a919-f8bbe3189ba0.pdf --view\n```\n\n## Upload from the frontend\n\n### Run the UI\n\n```sh\nnpm run dev # go to http://localhost:5176 \u0026 upload a PDF file \u0026 click on Upload PDF\n```\n\n### Compare the original PDF with the downloaded PDF\n\n```sh\ndiff-pdf api/Test_Invoice.pdf api/9fa9f0f2-eb3d-44fe-a919-f8bbe3189ba0.pdf --view\n```\n\n## For PDF/A-3 Convert Flow\n\n* Compile and run the lambda function locally (under /convert directory)\n* Upload a PDF file to the local S3 bucket (pdf-upload-bucket)\n* Run the command for converting the PDF to PDF/A-3 (Includes output indent, mark info and adding metadata - embedding fonts are excluded now due to the GhostScript complexity)\n\n```sh\ncurl -X POST \"http://127.0.0.1:3000/convert\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"file_key\": \"\u003cPDF-ID\u003e.pdf\"}'\n```\n\n* Download the PDF file from the local S3 bucket (pdf-upload-bucket - it should be named as converted-\u003cPDF-ID\u003e.pdf)\n\n```sh\naws --endpoint-url=http://localhost:4566 s3 cp s3://pdf-upload-bucket/converted-\u003cPDF-ID\u003e.pdf ./converted-\u003cPDF-ID\u003e.pdf\n```\n\n* Compare the original PDF with the downloaded PDF (Todo)\n\n## Notes\n\n* You can find the profile files within the /api/convert directory (sRGB_v4_ICC_preference.icc)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwclass%2Fpdf-over-the-wire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhwclass%2Fpdf-over-the-wire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwclass%2Fpdf-over-the-wire/lists"}