Sample code for 30+ languages & platforms
Tcl

Convert HTML to Plain Text

Demonstrates how to convert HTML to plain text.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set h2t [new_CkHtmlToText]

set html [CkHtmlToText_readFileToString $h2t "c:/temp/test.html" "utf-8"]
if {[CkHtmlToText_get_LastMethodSuccess $h2t] == 0} then {
    puts [CkHtmlToText_lastErrorText $h2t]
    delete_CkHtmlToText $h2t
    exit
}

set plainText [CkHtmlToText_toText $h2t $html]
if {[CkHtmlToText_get_LastMethodSuccess $h2t] == 0} then {
    puts [CkHtmlToText_lastErrorText $h2t]
    delete_CkHtmlToText $h2t
    exit
}

puts "$plainText"

delete_CkHtmlToText $h2t