Welcome to the GroupDocs.Parser for Java GroupDocs.Parser is a convenient text extractor API that permits users to extract raw or formatted text from different document formats. Besides, the user can extract metadata from the document.
GroupDocs.Parser for Java
Overview
GroupDocs.Parser for Java is a powerful PDF text extraction library for Java that enables developers to parse and extract information from over 65 document types. This library allows you to extract text from PDF files, Word documents, Excel spreadsheets, and more. You can extract raw or formatted text, metadata, images, tables, and other structured data from various file formats. The library works without requiring additional software installations; OCR of scanned documents is available through an OCR connector that you plug in (see OCR usage).
Key Highlights
65+ document formats - Support for PDF, Office documents, images, archives, and more
Template-Based Parsing - Extract structured data using predefined templates
Multiple Extraction Modes - Raw text, formatted text, and precise data extraction
Enterprise Ready - Scalable solution for high-volume document processing
Cross-Platform - Runs on Java 8 or later on Windows, Linux and macOS
What Makes GroupDocs.Parser Unique?
Template-Driven Extraction
One of the most powerful features is parsing documents with predefined templates. Easily define templates to extract specific data from invoices, receipts, contracts, and other structured documents with high precision.
Versatile Text Extraction
Raw Text Mode - Fast extraction for basic text processing
Formatted Text Mode - Preserve document formatting and structure
Search & Highlight - Advanced text search with regex support and keyword highlighting
For Linux: No native packages are required. Install TrueType fonts (for example, ttf-mscorefonts-installer) if you generate page previews or extract text areas.
importcom.groupdocs.parser.Parser;importcom.groupdocs.parser.data.TextReader;// Create an instance of Parser class
try(Parserparser=newParser("sample.pdf")){// Extract text from the document
try(TextReaderreader=parser.getText()){// Check if text extraction is supported
if(reader!=null){// Print the extracted text
System.out.println(reader.readToEnd());}else{System.out.println("Text extraction isn't supported for this format");}}}
Core Features
Text Extraction
Raw and formatted text extraction
Page-wise text extraction
Text areas extraction with coordinates
Search text with advanced options (case sensitivity, whole words, regex)
Content Indexing - Extract and index document content for search engines
Document Classification - Categorize documents based on extracted content
Legal & Compliance
eDiscovery Solutions - Extract and analyze text from legal documents
Contract Analysis - Parse contracts for key terms and clauses
Regulatory Compliance - Extract data for compliance reporting
Financial Services
Invoice Processing - Parse invoices, receipts, and financial documents
Automated Data Entry - Extract structured data from forms
Financial Document Analysis - Process statements and reports
Data Migration & Integration
Legacy System Migration - Extract content from old document formats
System Integration - Parse documents for API integrations
Data Transformation - Convert unstructured data to structured formats
Advanced Features
Template-Based Data Extraction
Create custom templates to extract specific data fields:
// Create a template with fixed positions
Templatetemplate=newTemplate(java.util.Arrays.asList(newTemplateField(newTemplateFixedPosition(newRectangle(newPoint(35,135),newSize(100,10))),"CompanyName"),newTemplateField(newTemplateFixedPosition(newRectangle(newPoint(35,150),newSize(100,10))),"InvoiceNumber")));// Parse document using template
try(Parserparser=newParser("invoice.pdf")){DocumentDatadata=parser.parseByTemplate(template);// Process extracted data
}
File[]files=newFile("C:\\Documents").listFiles(File::isFile);if(files!=null){for(Filefile:files){try(Parserparser=newParser(file.getPath())){// Extract and process data from each file
try(TextReaderreader=parser.getText()){if(reader!=null){Stringcontent=reader.readToEnd();// Process the content
}}}catch(UnsupportedDocumentFormatExceptionex){// Skip files of unsupported formats
}}}
Performance & Scalability
High Performance - Raw text extraction mode for performance-critical scenarios
Memory Efficient - Load documents from an InputStream and read text through a TextReader