This will provide you with a Cloud Storage bucket into which you can upload PDFs. They will automatically be converted to txt files and stored under the same name, with .txt appended.
To put this to use:
- Create a new project in Google Cloud
- Select project
- Go to compute engine and activate the API
- Cloud storage -> create bucket
- Enter bucket name -> Create -> enforce public access prevention
- Cloud functions -> create function
- if being prompted, enable all required APIs
- give a name to the Cloud Function
- trigger type: Cloud Storage
- Bucket: select the bucket you created
- click grant all
- click next
- Enable required APIs
- select python 3.12
- insert main.py's and requirements.txt's code
- click deploy
- make the default compute service account Cloud Run Invoker (IAM will show you the default compute service account, edit this principal and add the role Cloud Run Invoker)
- Now you can test this by uploading a PDF to the bucket you created.