Convert documents to PDF using LibreOffice
This example demonstrates how to convert documents to PDF using LibreOffice with Trigger.dev.
Prerequisites
- A project with Trigger.dev initialized
- LibreOffice installed on your machine
- A Cloudflare R2 account and bucket
Using our aptGet
build extension to add the LibreOffice package
To deploy this task, you’ll need to add LibreOffice to your project configuration, like this:
Build extensions allow you to hook into the build system and customize the build process or the resulting bundle and container image (in the case of deploying). You can use pre-built extensions or create your own.
You’ll also need to add @trigger.dev/build
to your package.json
file under devDependencies
if you don’t already have it there.
Convert a document to PDF using LibreOffice and upload to R2
This task demonstrates how to use LibreOffice to convert a document (.doc or .docx) to PDF and upload the PDF to an R2 storage bucket.
Key Features
- Fetches a document from a given URL
- Converts the document to PDF
- Uploads the PDF to R2 storage
Task code
Testing your task
To test this task, use this payload structure:
Local development
To test this example task locally, be sure to install any packages from the build extensions you added to your trigger.config.ts
file to your local machine. In this case, you need to install .
Was this page helpful?