GroupDocs.Editor와 함께 Java 문서 메타데이터 추출
Word, Excel 또는 일반 텍스트 파일에서 정보를 수동으로 추출하는 것이 지겹 자동 다양한 기술입니다. 이 가이드에서는 읽고, 문서 유형을 감지하며, 비밀번호로 보호된 파일까지 다루는 방법을 실제 예시와 함께 단계별로 안내합니다.
Quick Answers
- “extract document metadata java”는 무엇을 의미하나요? Java를 사용해 문서의 형식, 페이지 수, 크기, 암호화 상태와 같은 속성을 프로그래밍 방식으로 읽는 것을 말합니다.
- 어떤 라이브러리가 이를 도와주나요? GroupDocs.Editor for Java가 메타데이터 추출 및 유형 감지를 위한 간단한 API를 제공합니다.
- 프로세스 중에 document type java를 감지할 수 있나요? 예—반환된
IDocumentInfo를 검사하면 파일이 Word, 스프레드시트 또는 텍스트 문서인지 판단할 수 있습니다. - 라이선스가 필요합니까? 평가용 무료 체험이 가능하지만, 프로덕션 사용에는 영구 라이선스가 필요합니다.
- 주요 전제 조건은 무엇인가요? Java 8+, Maven(또는 수동 JAR 다운로드), 기본 Java 지식.
What is extract document metadata java?
Java에서 문서 메타데이터를 추출한다는 것은 전체 문서 내용을 로드하지 않고 파일 형식, 페이지 수, 작성자, 암호화 상태 등 설명 정보를 가져오는 것을 의미합니다. 이 경량 접근 방식은 인덱싱, 보관 및 규정 준수 검사를 빠르게 수행할 수 있게 해줍니다.
Why use GroupDocs.Editor for Java to detect document type java?
GroupDocs.Editor는 다양한 파일 형식의 복잡성을 추상화하여 비즈니스 로직에 집중할 수 있게 해줍니다. 문서 유형을 자동으로 식별하고, 유형별 속성을 노출하며, 보호된 파일도 원활히 처리하므로 detect document type java 시나리오에 이상적입니다.
Prerequisites
- Java Development Kit (JDK) 8 이상.
- Maven을 통한 의존성 관리(또는 수동 JAR 다운로드).
- Java 클래스와 예외 처리에 대한 기본 지식.
Setting Up GroupDocs.Editor for Java
Installation via Maven
Add the repository and dependency to your pom.xml:
<repositories>
<repository>
<id>repository.groupdocs.com</id>
<name>GroupDocs Repository</name>
<url>https://releases.groupdocs.com/editor/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-editor</artifactId>
<version>25.3</version>
</dependency>
</dependencies>
Direct Download
Alternatively, download the latest JAR from GroupDocs.Editor for Java releases.
License Acquisition
- Free Trial – 비용 없이 API를 살펴볼 수 있습니다.
- Temporary License – this link에서 제한된 기간의 키를 얻으세요.
- Purchase – 프로덕션 배포를 위한 영구 라이선스를 구매합니다.
Basic Initialization and Setup
import com.groupdocs.editor.Editor;
public class DocumentEditorSetup {
public static void main(String[] args) {
String filePath = "YOUR_DOCUMENT_DIRECTORY/SAMPLE_DOCX";
Editor editor = new Editor(filePath);
// Initialize your document processing workflow here
editor.dispose();
}
}
How to extract document metadata java
Feature 1: Extracting Metadata from Word Documents
Load the Document
import com.groupdocs.editor.Editor;
import com.groupdocs.editor.IDocumentInfo;
import com.groupdocs.editor.metadata.WordProcessingDocumentInfo;
String docxInputFilePath = "YOUR_DOCUMENT_DIRECTORY/SAMPLE_DOCX";
Editor editorDocx = new Editor(docxInputFilePath);
Extract Document Information
IDocumentInfo infoDocx = editorDocx.getDocumentInfo(null);
if (infoDocx instanceof WordProcessingDocumentInfo) {
WordProcessingDocumentInfo casted = (WordProcessingDocumentInfo) infoDocx;
// Access properties like format, page count, and more
}
editorDocx.dispose();
Explanation:
getDocumentInfo(null)은 전체 문서 본문을 로드하지 않고 메타데이터만 가져옵니다.WordProcessingDocumentInfo로 캐스팅하면 페이지 수, 작성자, 암호화 상태와 같은 Word‑특화 속성을 활용할 수 있습니다.
Feature 2: Detect document type java – Spreadsheets
Load the Spreadsheet File
import com.groupdocs.editor.Editor;
import com.groupdocs.editor.IDocumentInfo;
import com.groupdocs.editor.metadata.SpreadsheetDocumentInfo;
String xlsxInputFilePath = "YOUR_DOCUMENT_DIRECTORY/SAMPLE_XLSX";
Editor editorXlsx = new Editor(xlsxInputFilePath);
Check and Extract Information
IDocumentInfo infoXlsx = editorXlsx.getDocumentInfo(null);
if (infoXlsx instanceof SpreadsheetDocumentInfo) {
SpreadsheetDocumentInfo casted = (SpreadsheetDocumentInfo) infoXlsx;
// Retrieve properties like tab count, size, etc.
}
editorXlsx.dispose();
Explanation:
instanceof결과를 검사하면 detect document type java를 수행하고, 시트 수와 전체 크기와 같은 스프레드시트‑특화 메타데이터를 읽을 수 있습니다.
Feature 3: Handling Password‑Protected Documents
Load the Protected Document
import com.groupdocs.editor.Editor;
import com.groupdocs.editor.IDocumentInfo;
import com.groupdocs.editor.PasswordRequiredException;
import com.groupdocs.editor.IncorrectPasswordException;
String xlsInputFilePath = "YOUR_DOCUMENT_DIRECTORY/SAMPLE_XLS_PROTECTED";
Editor editorXls = new Editor(xlsInputFilePath);
Try Accessing with Password
try {
IDocumentInfo infoXls = editorXls.getDocumentInfo(null); // Attempt without password
} catch (PasswordRequiredException ex) {
System.out.println("A password is required to access this document.");
}
try {
IDocumentInfo infoXls = editorXls.getDocumentInfo("incorrect_password");
} catch (IncorrectPasswordException ex) {
System.out.println("The provided password is incorrect. Please try again.");
}
IDocumentInfo infoXls = editorXls.getDocumentInfo("excel_password"); // Correct password
if (infoXls instanceof SpreadsheetDocumentInfo) {
SpreadsheetDocumentInfo casted = (SpreadsheetDocumentInfo) infoXls;
// Extract document details
}
editorXls.dispose();
Explanation:
- API는 비밀번호가 없거나 잘못된 경우에 특정 예외를 발생시켜 사용자에게 안내하거나 우아하게 대체 로직을 수행할 수 있게 합니다.
Feature 4: Text‑Based Document Metadata Extraction
Load the Text‑Based Document
import com.groupdocs.editor.Editor;
import com.groupdocs.editor.IDocumentInfo;
import com.groupdocs.editor.metadata.TextualDocumentInfo;
String xmlInputFilePath = "YOUR_DOCUMENT_DIRECTORY/SAMPLE_XML";
Editor editorXml = new Editor(xmlInputFilePath);
Extract and Display Information
IDocumentInfo infoXml = editorXml.getDocumentInfo(null);
if (infoXml instanceof TextualDocumentInfo) {
TextualDocumentInfo casted1 = (TextualDocumentInfo) infoXml;
// Access encoding, size, etc.
}
editorXml.dispose();
Explanation:
- 이 방법은 인코딩 및 파일 크기 메타데이터가 주로 필요한 일반 텍스트 형식(TXT, XML, CSV)에서 작동합니다.
Practical Applications
- Automated Document Archiving – 메타데이터를 추출해 파일을 검색 가능한 저장소에 태그하고 보관합니다.
- Workflow Automation – 메타데이터를 활용해 문서를 적절한 부서로 라우팅하거나 후속 프로세스를 트리거합니다.
- Data Migration – 시스템 간 파일 이동 시 원본 속성을 보존합니다.
Performance Considerations
- Dispose Editors –
dispose()를 항상 호출해 네이티브 리소스를 해제합니다. - Large Files – 스트림이나 청크 단위로 처리해 메모리 사용량을 낮게 유지합니다.
- Profiling – 수천 개 파일을 다룰 때 병목 현상을 찾기 위해 Java 프로파일러를 활용합니다.
Common Issues & Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
PasswordRequiredException even though file isn’t protected | Wrong file path or corrupted file | Verify the path and file integrity |
null returned for metadata | Using an outdated library version | Upgrade to the latest GroupDocs.Editor release |
| Low performance on big Excel files | Loading whole file into memory | Use getDocumentInfo(null) (metadata‑only) and process in batches |
Frequently Asked Questions
Q: Can I extract metadata from PDF files with the same API?
A: GroupDocs.Editor focuses on editable formats (DOCX, XLSX, etc.). For PDFs, use GroupDocs.Metadata or GroupDocs.Viewer.
Q: How do I detect the document type without casting?
A: Call info.getDocumentType() which returns an enum (e.g., DocumentType.WordProcessing, DocumentType.Spreadsheet).
Q: Is it possible to extract custom properties embedded in Office files?
A: Yes—WordProcessingDocumentInfo and SpreadsheetDocumentInfo expose methods like getCustomProperties().
Q: Do I need a separate license for each document type?
A: No, a single GroupDocs.Editor license covers all supported formats.
Q: What Java version is required?
A: Java 8 or later; newer LTS versions (11, 17) are fully supported.
Conclusion
You now have a complete, production‑ready workflow for extract document metadata java and detect document type java using GroupDocs.Editor. Combine these snippets with your own business logic to automate archiving, compliance checks, or any scenario where document insight is valuable.
Last Updated: 2026-02-03
Tested With: GroupDocs.Editor 25.3 for Java
Author: GroupDocs