unoconv / unoserver

MIT License
598 stars 81 forks source link

Conversion from html to rtf not possible #23

Closed athalonis closed 1 year ago

athalonis commented 2 years ago

Conversion with libreoffice headless works:

> echo "<p>This is a test</p>" > sample.html
> libreoffice --nofirststartwizard --invisible --headless --convert-to 'RTF:Rich Text Format' sample.html --outdir /tmp/
convert /home/benbss/dev/baessler/PrefUsable/prefusable/sample.html -> /tmp/sample.RTF using filter : Rich Text Format

unoserver using unoconvert gives me:

> echo "<p>This is a test</p>" > sample.html 
> unoconvert --port 12345 --convert-to rtf sample.html /tmp/sample.rtf
INFO:unoserver:Starting unoconverter.
INFO:unoserver:Opening sample.html
Traceback (most recent call last):
  File "/usr/local/bin/unoconvert", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/unoserver/converter.py", line 247, in main
    result = converter.convert(
  File "/usr/local/lib/python3.8/dist-packages/unoserver/converter.py", line 185, in convert
    raise RuntimeError(
RuntimeError: Could not find an export filter from com.sun.star.text.WebDocument to writer_Rich_Text_Format

If figured out, there is no filter defined in com.sun.star.document.FilterFactory. Can anyone give me a hint how to get support for this conversion.

regebro commented 1 year ago

The --filterargument introduced in 1.3 solves this.

unoconvert --filter 'Rich Text Format' sample.html /tmp/sample.rtf