3

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:

  1. 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?)

  2. 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!

totoro
  • 3,257
  • 5
  • 39
  • 61
  • 1
    Have you tried [this approach](https://forum.openoffice.org/en/forum/viewtopic.php?t=3801)? – Anton Savin Aug 25 '14 at 09:13
  • thanks to your pointer, I found [this post](http://stackoverflow.com/questions/14169019/java-using-an-inputstream-as-a-file) which answered my question for java. any idea for python? – totoro Aug 25 '14 at 10:06

0 Answers0