(Classic ASP) Convert HTML to Plain Text
Demonstrates how to convert HTML to plain text.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.HtmlToText")
set h2t = Server.CreateObject("Chilkat.HtmlToText")
html = h2t.ReadFileToString("c:/temp/test.html","utf-8")
If (h2t.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( h2t.LastErrorText) & "</pre>"
Response.End
End If
plainText = h2t.ToText(html)
If (h2t.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( h2t.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( plainText) & "</pre>"
%>
</body>
</html>
|