PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDF Conversion SDK supports converting PDF documents to CSV (Comma-Separated Values). Converting PDF to CSV is a common need, usually used to extract tabular or structured data from PDF documents and convert it into CSV files.
PDF to CSV uses the PDF to Excel interface with the save-tables-as-CSV option enabled (disabled by default). The worksheet option decides how CSV files are split: ExcelWorksheetOption.FOR_TABLE (default) writes one CSV file per table, ExcelWorksheetOption.FOR_PAGE one per page, and ExcelWorksheetOption.FOR_DOCUMENT a single CSV file for the whole document.
When multiple CSV files may be output, you can control whether to automatically create folders to store the CSV files by setting the autoCreateFolder option (enabled by default). When this option is enabled, a folder with the same name as the output file will be automatically created in the output path to store the CSV files. With ExcelWorksheetOption.FOR_DOCUMENT only one CSV file is written and this option has no effect.
This sample demonstrates how to convert from a PDF to CSV file.
val excelOptions = ExcelOptions()
excelOptions.csvFormat = true
val error = ComPDFKitConverter.startPDFToExcel("csv.pdf", "", "output.csv", excelOptions)