converting html code to styled text

have anyone attempt to convert html code to styled text??

I am working on this project that required the existing data which is html code which need to be convert “RTFData” and show on a styled textarea control so they can select the text and do bold, italic and underline.

for new data, i am able to convert styled text to html code since i am using bob keeney wonderful PWStyleHTMLField Classes

On OS X, there is an utility (from Terminal) that does text conversions.

Check: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/textutil.1.html

Or, in the terminal type

man textutil

For Linux or Windows: Sorry I do not know.

For more entries in the apple web site, paste the following in Google:

site:developer.apple.com TEXTUTIL(1)

that is cool. don’t know u can do that on the mac. a pity since i need the window equivalent.

“similar” things exists in Windows too: command lines.

a manual look does not let me find text to html / html to rtf or anything that’s looking about your search. This does not means nothing exists.

Google search string was:

site:microsoft.com "command line"

Load the HTML in Word and save as RTF :slight_smile:

I did it for my own doc. Works fine.

I’m bumping this simply because I have a need to do this in Windows. Anyone have any new suggestions? I can’t depend on users having Word installed so I’m looking for a common Windows solution. Any ideas?

check out Pandoc at http://johnmacfarlane.net/pandoc/

I’m actually working on a control for this (from the original post)
Take a peek at HTML Edit Demo.xojo_binary_project and play with it. I’m sorting out an issue with Windows at the moment, but I expect to have it resolved shortly. PM me or email me (timi at timi dot me) if it meets your needs.

On OS X, a couple of declares will load HTML into a Text Area. For Windows, I have no idea.

However HTML is fairly straight forward language and it wouldn’t take too much to create a custom parser to process HTML.

Here is a TextConverter (OSX) I made last year with Xojo (I used textutil)

RTF, TXT, HTML, DOC
to
RTF, TXT, HTML, DOC, PDF

TextConverter

That seems to be the GPL license.
I guess you could ask the customer to install that, check if it exists on their machine, and if it does call the command line program.
Integrating it would probably violate the GPL if your software is not GPL. Even calling it from the command line for functionality that your program depends on would probably violate the spirit of GPL if not the letter?
Having to ask the customer to install it is not exactly customer friendly either.
I guess this is a solution for a limited amount of situations.

Maybe this?
http://www.codeproject.com/Articles/7087/XHTML-RTF-An-HTML-to-RTF-conversion-tool-based-on
This is lesser GPL and might work.
Unfortunately the html needs some preprocessing to XHTML (see the usage section) so this is also not ideal.

It’s a shame about Pandoc. It seems like a perfect solution in a lot of cases.

[quote=160413:@Dirk Cleenwerck]Maybe this?
http://www.codeproject.com/Articles/7087/XHTML-RTF-An-HTML-to-RTF-conversion-tool-based-on
This is lesser GPL and might work.
Unfortunately the html needs some preprocessing to XHTML (see the usage section) so this is also not ideal.[/quote]

is lesser GPL the same as LGPL??

so can i include wkhtmltopdf in my application as a external file and use command line to call when needed?

It won’t handle CSS for you but this might work: http://reimagery.com/fsfd/html.htm#cvspec

what wouldn’t handle CSS??

The program I linked to is a very old HTML to RTF converter named Ishtar. It predates CSS so it will only do basic HTML conversions.

I don’t think that is the common interpretation of GPL binary usage.

My understanding is that you can supply a GPL binary (to run from the command line) as long as you make it easy to also get the source for the GPL binary.

One reference on StackOverflow seems to agree: http://stackoverflow.com/questions/5437501/can-i-use-gpl-software-binaries-in-commercial-environment

Heck, Xcode used to use the GCC compiler and there was no requirement for Apple to provide the full source to Xcode.

But when in doubt, leave it to the lawyers.

[quote=162934:@Richard Duke]is lesser GPL the same as LGPL??

so can i include wkhtmltopdf in my application as a external file and use command line to call when needed?[/quote]

lesser GPL is indeed LGPL.
Sorry for the late reply. I’ve been sick for a few days. I’m slightly better now and back to work.
Viral infections are annoying (the human kind, not the computer kind, although that one is annoying as well)