Objective-C
Objective-C
Convert HTML to Plain Text
Demonstrates how to convert HTML to plain text.Chilkat Objective-C Downloads
#import <CkoHtmlToText.h>
#import <NSString.h>
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHtmlToText *h2t = [[CkoHtmlToText alloc] init];
NSString *html = [h2t ReadFileToString: @"c:/temp/test.html" srcCharset: @"utf-8"];
if (h2t.LastMethodSuccess == NO) {
NSLog(@"%@",h2t.LastErrorText);
return;
}
NSString *plainText = [h2t ToText: html];
if (h2t.LastMethodSuccess == NO) {
NSLog(@"%@",h2t.LastErrorText);
return;
}
NSLog(@"%@",plainText);