Converts all document formats using LibreOffice first to PDF and then to an image, using build-in pdf previwer of ActiveStorage
- needs:
unoconv
, a command line tool which uses libreoffice, e.g.apt install unoconv
- needs a PDF converter, because libreoffice will make a pdf from the office document, Mupdf oder Poppler are already integrated into ActiveStorage, and poppler is free to use, e.g.
apt install poppler-utils
That code is from a working Rails 5.2 app, I didn't test it with Rails 6 yet.
Yes, one has to pass a Blob, but just passing nil as that blob worked at least in the 5.2.