2

I need a library for my ASP.NET MVC3 Application that can convert to and from HTML and RTF.

There are a lot out there that do just one, converting RTF to HTML. But I need to be able to go backwards too.

The closest Ive come is: http://code.msdn.microsoft.com/windowsdesktop/Converting-between-RTF-and-aaa02a6e

But that throws the error The calling thread must be STA, because many UI components require this. Despite Ive not changed the code at all.

IAmGroot
  • 13,760
  • 18
  • 84
  • 154
  • Possible duplicate of this question? take a look at http://stackoverflow.com/questions/150208/how-do-i-convert-html-to-rtf-rich-text-in-net-without-paying-for-a-component – Dr. Andrew Burnett-Thompson Jan 16 '12 at 15:45
  • Does not cover how I convert RTF to HTML. thanks anyway. – IAmGroot Jan 16 '12 at 15:50
  • Do you have a very simple example of the RTF that you're converting that you could paste into the question where you're getting the error? Did you modify the code from that link at all? – JustBeingHelpful Jan 17 '12 at 01:41
  • I tried using it like a DLL library ( so that I can convert my input/output ). But was unsuccessful. It works fine with its own GUI. Any RTF in this scenario. – IAmGroot Jan 17 '12 at 09:32
  • This question is unlikely to get many answers. You might want to consider splitting it up into RTF -> HTML and HTML -> RTF. – casperOne Jan 17 '12 at 18:49

2 Answers2

1

Disclaimer: I'm working for this company.

Doomsknight, try to use our dll library. about RTF to HTML i have posted here, what about HTMl to RTF our company also have the component for this "HTML to RTF" here http://www.htmltortf.com/convert-html-to-rtf-net/html-to-rtf-csharp-aspnet.php. Online version of HTML to RTF Pro DLL.Net also available.

Small sample code to help: Convert HTML file to RTF file in C#:

        SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
        h.PageStyle.PageSize.Letter();
        h.ConvertFile(@"c:\test.htm", @"c:\test.rtf");

All the best :)

Community
  • 1
  • 1
SautinSoft
  • 69
  • 5
0

You should use xslt, if your html is xml compliant for the converstion to rtf. Do a search for html2rtf.xsl[t] and you should be able to find something.

Random
  • 1,896
  • 3
  • 21
  • 33