On this page
Guides
Convert PDF to TXT
Overview
When you need to extract the text content in the PDF file, in order for data analysis, text mining, information retrieval, etc. Using CompDF Convert SDK, you can easily extract the text in the PDF into the TXT file.
Notice
- The current version of SDK will ignore the rotated PDF text.
Sample
This sample demonstrates how to convert from a PDF to TXT file.
objective-c
// Get the path of the PDF file.
NSString *pdfPath = @"...";
// Get the path of the TXT file.
NSString *outputPath = @"...";
CPDFConvertTxtOptions * options = [[CPDFConvertTxtOptions alloc] init];
[options setIsAllowOCR:YES];
[options setLanguage:COCRLanguageEnglish];
CPDFConverterTxt *converter = [[CPDFConverterTxt alloc] initWithURL:[NSURL fileURLWithPath:pdfPath] password:nil];
[converter convertToFilePath:outputPath pageIndexs:nil options:options];