Sample code for 30+ languages & platforms
Go

Convert HTML to Plain Text

Demonstrates how to convert HTML to plain text.

Chilkat Go Downloads

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

    h2t := chilkat.NewHtmlToText()

    html := h2t.ReadFileToString("c:/temp/test.html","utf-8")
    if h2t.LastMethodSuccess() == false {
        fmt.Println(h2t.LastErrorText())
        h2t.DisposeHtmlToText()
        return
    }

    plainText := h2t.ToText(*html)
    if h2t.LastMethodSuccess() == false {
        fmt.Println(h2t.LastErrorText())
        h2t.DisposeHtmlToText()
        return
    }

    fmt.Println(*plainText)

    h2t.DisposeHtmlToText()