I’m looking for a solution to generate document (ideally docx but pdf is ok) from a database

Ex: I have a project entry (with client info, dates, information about the project, etc.) and I want to generate documents from a tender templates, containing selected entries from the database.

Here is what I tried until now :

  • Custom database (tinyDB) + custom webpage form + a docx template with jinja markups served by a homemade webpage hosted on pythonanywhere (lot of work and not reliable as I’m doing everything myself)
  • Nocodb form and database (no document generation yet) (self-hosted or on cloud)
  • Airtable (closed source and on cloud) for forms, database and document generation

Airtable is what I’m currently trying because it’s the only one that I found that have lot of support and adds on.

There are a few options on Airtable for document generation, lot of which cost around $30/month which is why I’m looking for a viable alternative. Ideally I would like to be able to upload my already made templates.

More point to the solution if it’s supports geodata

I’m considering keeping airtable and using the api to generate document with the python program I used on the first point, but I’d like to know if there is more options.

EDIT2: to be concise: I’m looking for an alternative to Airtable + Make. Ideally, FOSS and self-hostable or on cloud

Edit: precision: I need to create a document that contains multiple items of the db. Ex: I need to create a resume with different experiences that are saved in the database

Here is an example of a template:

  • Biorix@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    It is, but the main issue is how to select the values from the database and to render without the user needing to tweak anything

    Latex, MD, Word is equivalent (although Word is preferred) since I’ll just place universal markers in it

    • stuner@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 months ago

      One way to do it is have a small Python (or any other scripting language really) script that performs text replacements in the Latex source file. This is much easier in Latex because it’s plain text. I don’t know of a solution that doesn’t involve writing your own code (apart from LO/Word serial letters).

    • dave@hal9000@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 months ago

      I am working on something similar and also planning on LaTex because it will be so easy to do find and replace because it’s plain text (just adding placeholders like ##NAME## or whatever), but I’m only planning on outputting PDFs, which would be easy enough. I don’t think there’s many viable solutions to go LaTex to docx if that’s a big requirement for you

      • Biorix@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 months ago

        I’m using docxtpl which uses jinja placeholder to set values.

        For your solution, you should use jinja It’s used for whatever text files you want, htlm, txt, latex, MD, etc. And you can put code into the document (see my examples document in the post)

        • dave@hal9000@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          5 months ago

          Ah thanks! I am working with .NET, and I was surprised how there’s little out there in terms of (open source) libraries for LaTex (I did some research since this comment). I might end up going with docx via the OpenXML API. Also, I haven’t really used LaTex before (has been on on my learning to-do list), and once I started messing with some templates, I realized I need to learn a lot more first.

          One thing with my documents is that find and replace alone won’t work, as I need to replace some patterns. I am generating resumes, so I need to take something like a pattern for a job, and then repeat it several times