HtmlToText C Library Reference
HtmlToText
HTML to plain-text conversion C library. The internal conversion process is much more sophisticated than can be accomplished with the simple regular-expression freeware codes found in the Internet. This is more than simply removing HTML tags from an HTML document.
Create/Dispose
HCkHtmlToText CkHtmlToText_Create(void);
Creates an instance of the CkHtmlToText object and returns a handle (i.e. a "void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.
void CkHtmlToText_Dispose(HCkHtmlToText handle);
Objects created by calling CkHtmlToText_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.
C "Properties"
void CkHtmlToText_getLastErrorHtml(HCkHtmlToText cHandle, HCkString retval);
Error information in HTML format for the last method called.
void CkHtmlToText_getLastErrorText(HCkHtmlToText cHandle, HCkString retval);
Error information in plain-text format for the last method called.
void CkHtmlToText_getLastErrorXml(HCkHtmlToText cHandle, HCkString retval);
Error information in XML format for the last method called.
int CkHtmlToText_getRightMargin(HCkHtmlToText cHandle); void CkHtmlToText_putRightMargin(HCkHtmlToText cHandle, int newVal);
Used to control wrapping of text. The default value is 80. When the text gets close to this margin, the converter will try to break the line at a SPACE character.
BOOL CkHtmlToText_getUtf8(HCkHtmlToText cHandle); void CkHtmlToText_putUtf8(HCkHtmlToText cHandle, BOOL newVal);
To be documented soon...
C "Methods"
BOOL CkHtmlToText_IsUnlocked(HCkHtmlToText cHandle);
Returns true if the component is already unlocked. Otherwise returns false.
BOOL CkHtmlToText_ReadFileToString(HCkHtmlToText cHandle, const char *filename, const char *srcCharset, HCkString outStr);
Convenience method for reading a text file into a string. The character encoding of the text file is specified by srcCharset. Valid values, such as "iso-8895-1" or "utf-8" are listed at: List of Charsets.
BOOL CkHtmlToText_SaveLastError(HCkHtmlToText cHandle, const char *filename);
Saves the last error information to an XML formatted file.
BOOL CkHtmlToText_ToText(HCkHtmlToText cHandle, const char *html, HCkString outStr);
Converts HTML to plain-text.
BOOL CkHtmlToText_UnlockComponent(HCkHtmlToText cHandle, const char *code);
Unlocks the component. An arbitrary unlock code may be passed to automatically begin a 30-day trial.
This class is included with the Chilkat HTML-to-XML conversion component license. A permanent unlock code for Chilkat HTML-to-XML should be used to unlock this object.
BOOL CkHtmlToText_WriteStringToFile(HCkHtmlToText cHandle, const char *str, const char *filename, const char *charset);
Convenience method for saving a string to a file. The character encoding of the output text file is specified by outpuCharset (the string is converted to this charset when writing). Valid values, such as "iso-8895-1" or "utf-8" are listed at: List of Charsets.
const char *CkHtmlToText_lastErrorHtml(HCkHtmlToText cHandle);
Error information in HTML format for the last method called.Returns a null on failure
const char *CkHtmlToText_lastErrorText(HCkHtmlToText cHandle);
Error information in plain-text format for the last method called.Returns a null on failure
const char *CkHtmlToText_lastErrorXml(HCkHtmlToText cHandle);
Error information in XML format for the last method called.Returns a null on failure
const char *CkHtmlToText_readFileToString(HCkHtmlToText cHandle, const char *filename, const char *srcCharset);
Convenience method for reading a text file into a string. The character encoding of the text file is specified by srcCharset. Valid values, such as "iso-8895-1" or "utf-8" are listed at: List of Charsets. Returns a null on failure
const char *CkHtmlToText_toText(HCkHtmlToText cHandle, const char *html);
Converts HTML to plain-text. Returns a null on failure
|