Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python - pythonnet doesn't work #84

Open
kklem0 opened this issue Aug 29, 2023 · 0 comments
Open

python - pythonnet doesn't work #84

kklem0 opened this issue Aug 29, 2023 · 0 comments

Comments

@kklem0
Copy link

kklem0 commented Aug 29, 2023

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)
@kklem0 kklem0 changed the title pythonnet doesn't work python - pythonnet doesn't work Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant