I am working on a project where I need to convert various document formats into pdf. After doing some search, open office (libreoffice) looks like a good option. I don't want to do system call such as soffice --headless --convert-to pdf filenam
for efficiency.
Rather, I would like to use the python UNO interface. Two related questions are below:
I found some examples where you can load a file from disk by doing something like
document = desktop.loadComponentFromURL("file:///home/lucas/myfile.odt" ,"_blank", 0, ())
before saving it to disk as pdf. My app accepts user uploaded files, and I would like to load the file directly from memory (assuming the file fits in memory) rather than having to save it to disk first. Is there anyway to achieve this via the uno interface or other methods (perhaps somehow presenting a file in memory as on disk?)The OpenOffice is a powerful suite and I only need its format conversion functionality. I downloaded its source code in an attempt to isolate the components necessary for conversion, but soon got lost. Any tips for where to start?
Thanks in advance!