Skip to content
DemoFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

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.

Preserving Table Format ​

The SDK supports an option called TableFormat that preserves the table format when writing the TXT file, meaning that the original table structure is maintained. It is generally recommended to enable this option, especially for data extraction scenarios.

Sample ​

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

c#
string inputFilePath = "***";
string password = "***";
string outputFileName = "***";
TxtOptions txtOptions = new TxtOptions();
ErrorCode error = CPDFConversion.StartPDFToTxt(inputFilePath, password, outputFileName, txtOptions);