I would like to know if it’s possible to trigger a pdf creation on collabora, via some API call, to transform a .docx document into PDF while also replacing some fields values in the source document?
I currently have a Nextcloud 29.0.4.1 installed with collabora Collabora Online Development Edition 24.04.5.2
My need, is to obtain a PDF from a template with some placeholder replaced. Like, name, first-name, date, address, etc.
Hi @Sylvain, welcome to the Collabora Online forums!
I came across a solution that might be useful for your needs, involving the REST API for document conversion. From what I understand, there may be some adjustments you’ll need to make, such as replacing placeholders with values before converting, but I’m confident you can get it working!
Here’s a suggested approach:
Use a scripting language like Python to open the .docx template, replace the placeholders with the required values, and save the updated document. The python-docx library can help with this:
Once the document is updated, you can use the Collabora Online REST API to convert it to PDF.