RtfPipe
RtfPipe copied to clipboard
python - pythonnet doesn't work
This can be a bug report or a future note for how to use it with pythonnet.
If you use it directly you'll get even if you use System.String
TypeError: No method matches given arguments for Rtf.ToHtml: (<class 'str'>)
Instead load it into RtfSource first with System.IO.StringReader then it works.
import clr
clr.AddReference('/Users/me/RtfPipe.dll')
import RtfPipe
import System
test = '{\pard test \par}'
net_string = System.String(test)
string_reader = System.IO.StringReader(net_string)
rtf_source = RtfPipe.RtfSource(string_reader)
html_output = RtfPipe.Rtf.ToHtml(rtf_source)
print(html_output)