Skip to content
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.

Note

  • The current version of SDK ignores the text rotating in PDF.

Sample

This sample demonstrates how to convert from a PDF to TXT files.

kotlin
val cPDFConvert = CPDFConverterTxt(context, uri, "")

val params = CPDFConvertTxtOptions()

val result: ConvertError = cPDFConvert.convert(outputDir, outputFilenameNoSuffix, params, pageArrays, 
onHandle = onHandleCal, 
onProgress = onProgressCal, 
onPost = onPostCal)