Long story short, I want to build a system that reorders some components in a document file (be it a docx or odt, I don’t have a hard constraint atm).

So my problem input should be a document file, and I need to be able to approximate the number of pages consumed by this document file, I also need to be able to get the height of individual components (like a single paragraph or a table) to have the data I need to rearrange so I can make the document have less pages.

I don’t have a hard constraint on the programming language of the tool either (Python preferred), I prefer not embedding LibreOffice into my system.

Also I’m willing to hear other solutions (maybe my input is not the optimal thing I can use for this problem).

Thanks in advance!

  • ericjmorey
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Use Google Apps Script to open the document in Google Docs, read the number of pages that Google Docs renders, closes the document, then delets the document (optional).

    • Red1C3@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I need to automate the process to use it during an algorithm, this is far from practical.

      • ericjmorey
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        edit-2
        1 year ago

        My suggestion was to automate the process using Google Apps Script using an algorithm. You’ve not given a lot of details about what you actually want to do but for what you did give, Google Apps Script would let you automate the task.