Java에서 GroupDocs.Conversion을 사용한 이메일 PDF 변환: 고급 옵션 가이드

이메일 메시지를 PDF로 변환하는 것은 보관, 공유 및 데이터 프라이버시 보장을 위해 흔히 요구되는 작업입니다. 이 튜토리얼에서는 Java용 GroupDocs.Conversion을 사용한 email to pdf conversion을 마스터하고, 특정 이메일 필드를 숨기거나 표시하는 방법과 최의 성능을 위한 프로세스 미세 조정 방법을 배웁니다.

빠른 답변

  • What library handles email to PDF conversion? GroupDocs.Conversion for Java.
  • Which Maven artifact do I need? com.groupdocs:groupdocs-conversion.
  • Can I hide sender/recipient details? Yes—use EmailLoadOptions to control visibility.
  • Is a license required for production? A valid GroupDocs license is needed for non‑trial use.
  • What Java version is supported? Java 8 or higher.

Email to PDF 변환이란?

Email to PDF conversion은 .msg, .eml 등 이메일 형식을 정적이고 휴대 가능한 PDF 문서로 변환합니다. 이 과정은 원본 메시지 레이아웃을 유지하면서 이메일 주소, 헤더, CC/BCC 필드와 같은 민감한 정보를 삭제할 수 있게 해줍니다.

Java용 GroupDocs.Conversion을 사용해야 하는 이유

GroupDocs.Conversion은 간단한 API, 강력한 형식 지원, 그리고 이메일의 어느 부분을 최종 PDF에 포함시킬지 정확히 제어할 수 있는 세밀한 로드 옵션을 제공합니다. 또한 Maven과 원활하게 통합되어 의존성 관리를 쉽게 할 수 있습니다.

사전 요구 사항

  • Java Development Kit (JDK) 8+ 설치.
  • Maven을 이용한 의존성 관리 (아래 groupdocs conversion maven 섹션 참고).
  • Java와 Maven 프로젝트에 대한 기본적인 이해.

Java용 GroupDocs.Conversion 설정하기

시작하려면 GroupDocs 저장소와 변환 의존성을 `pom에 추가합니다. 이것이 필요한 groupdocs conversion maven 구성입니다.

<repositories>
    <repository>
        <id>repository.groupdocs.com</id>
        <name>GroupDocs Repository</name>
        <url>https://releases.groupdocs.com/conversion/java/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-conversion</artifactId>
        <version>25.2</version>
    </dependency>
</dependencies>

라이선스 획득

  • Free Trial – 비용 없이 모든 기능을 탐색할 수 있습니다.
  • Temporary License – 평가 기간을 연장하기 위한 단기 키를 요청합니다.
  • Purchase – 프로덕션 배포를 위한 정식 라이선스를 획득합니다.

구현 가이드

고급 옵션을 사용한 이메일 PDF 변환

아래 단계별 예제는 convert msg to pdf를 수행하면서 필드 가시성을 맞춤 설정하는 방법을 보여줍니다.

Step 1: Configure Email Load Options

EmailLoadOptions 인스턴스를 생성하고 PDF에 표시하고 싶지 않은 필드를 끕니다.

import com.groupdocs.conversion.options.load.EmailLoadOptions;

EmailLoadOptions loadOptions = new EmailLoadOptions();
loadOptions.setDisplayHeader(false);
loadOptions.setDisplayFromEmailAddress(false);
loadOptions.setDisplayToEmailAddress(false);
loadOptions.setDisplayEmailAddress(false);
loadOptions.setDisplayCcEmailAddress(false);
loadOptions.setDisplayBccEmailAddress(false);
loadOptions.setConvertOwned(false); // Prevent conversion of fields that are owned by the document

Step 2: Initialize the Converter

Converter 객체를 만들 때 구성한 로드 옵션을 전달합니다.

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;

Converter converter = new Converter("YOUR_DOCUMENT_DIRECTORY/SAMPLE_MSG", () -> loadOptions);

Step 3: Set PDF Conversion Options

PdfConvertOptions를 사용해 PDF 출력을 추가로 맞춤 설정할 수 있습니다. 이 예제에서는 기본 설정으로 충분합니다.

PdfConvertOptions options = new PdfConvertOptions();

Step 4: Perform the Conversion

convert 메서드를 호출하고 대상 경로와 위에서 정의한 옵션을 제공합니다.

converter.convert("YOUR_OUTPUT_DIRECTORY/ConvertEmailWithAlteringFieldsVisibility.pdf", options);

문서 유형별 로드 옵션

다양한 문서 유형을 로드하는 방법을 이해하는 것은 유연한 변환에 필수적입니다. 아래는 이메일에 초점을 맞춘 예제입니다.

Step 1: Configure Email Load Options (Re‑used)

import com.groupdocs.conversion.options.load.EmailLoadOptions;

EmailLoadOptions emailLoadOptions = new EmailLoadOptions();
emailLoadOptions.setDisplayHeader(false);
emailLoadOptions.setDisplayFromEmailAddress(false);
emailLoadOptions.setDisplayToEmailAddress(false);
emailLoadOptions.setDisplayEmailAddress(false);
emailLoadOptions.setDisplayCcEmailAddress(false);
emailLoadOptions.setDisplayBccEmailAddress(false);
emailLoadOptions.setConvertOwned(false); // Do not convert owned fields

Step 2: Initialize Converter with Email Load Options

Converter emailConverter = new Converter("EMAIL_FILE_PATH", () -> emailLoadOptions);

실용적인 적용 사례

email to pdf conversion이 빛을 발하는 실제 시나리오 세 가지를 소개합니다:

  1. Legal Documentation – 클라이언트와 이메일 증거를 공유하기 전에 개인 데이터를 삭제합니다.
  2. Corporate Archiving – 내부 커뮤니케이션을 표준화된 읽기 전용 형식으로 저장합니다.
  3. Personal Organization – 불필요한 주소를 노출하지 않으면서 중요한 메시지를 깔끔한 PDF 아카이브로 보관합니다.

성능 고려 사항

  • Optimize File Sizes – 작은 배치로 처리하거나 변환 후 PDF를 압축합니다.
  • Memory Management – Java 가비지 컬렉터를 활용하고 한 번에 큰 이메일을 메모리에 로드하지 않도록 합니다.
  • Stay Updated – 성능 향상을 위해 최신 GroupDocs.Conversion 버전으로 정기적으로 업그레이드합니다.

일반적인 문제 및 해결책

문제원인해결책
OutOfMemoryError on large .msg filesWhole file loaded into memoryStream the email content or increase JVM heap size (-Xmx2g).
Missing email body in PDFdisplayHeader set to true while body hiddenEnsure setDisplayHeader(false) only hides headers; body remains visible.
License not recognizedUsing trial key in productionReplace with a valid production license file or string.

자주 묻는 질문

Q: What is GroupDocs.Conversion for Java?
A: It’s a Java library that enables conversion between over 100 file formats, including email to PDF conversion.

Q: How do I ensure email privacy during conversion?
A: Use EmailLoadOptions to turn off fields such as sender, recipient, and CC/BCC addresses before conversion.

Q: Can I convert other document types besides email?
A: Yes, the library supports Word, Excel, PowerPoint, images, and many more formats.

Q: What are the memory requirements for converting large emails?
A: Allocate sufficient heap space (e.g., -Xmx2g) and consider processing files in batches.

Q: Where can I find more information on GroupDocs.Conversion?
A: Visit the official documentation and API reference.

리소스


Last Updated: 2026-01-18
Tested With: GroupDocs.Conversion 25.2
Author: GroupDocs