Java용 IronPDF - Java 애플리케이션에서 PDF를 생성, 편집 및 읽기

This article was translated from English: Does it need improvement?
Translated
View the article in English

Java용 IronPDF 소개

IronPDF for Java는 Iron Software에서 개발 및 유지 관리하는 라이브러리로, 소프트웨어 엔지니어가 Java 8+, Kotlin 및 Scala 프로젝트에서 PDF 콘텐츠를 생성, 편집 및 추출할 수 있도록 지원합니다.

IronPDF for Java.NET용 IronPDF 의 성공과 인기를 기반으로 구축되었습니다.

Java용 IronPDF는 gRPC를 사용하여 IronPdfEngine와 통신합니다.

IronPDF는 다음과 같은 점에서 뛰어납니다.

  • HTML, URL, JavaScript, CSS 및 다양한 이미지 형식을 기반으로 PDF 생성
  • 머리글/바닥글, 서명, 첨부 파일, 암호 및 보안 추가
  • 성능 최적화: 완벽한 멀티스레딩 및 비동기 지원
  • 그리고 훨씬 더 많습니다! 저희 웹사이트를 방문하시면 모든 코드 예제와 50개 이상의 기능 전체 목록을 확인하실 수 있습니다.

Java용 IronPDF 사용

IronPDF를 Java 종속성으로 정의합니다.

pom.xml 종속성

IronPDF를 종속성으로 정의하려면 다음 내용을 pom.xml에 추가하십시오.

<dependencies>

    <dependency>
        <groupId>com.ironsoftware</groupId>
        <artifactId>ironpdf</artifactId>
        <version>20xx.xx.xxxx</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>2.0.3</version>
    </dependency>

</dependencies>
<dependencies>

    <dependency>
        <groupId>com.ironsoftware</groupId>
        <artifactId>ironpdf</artifactId>
        <version>20xx.xx.xxxx</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>2.0.3</version>
    </dependency>

</dependencies>
XML

JAR 파일 다운로드

선택적으로 IronPDF JAR 파일을 수동으로 다운로드하여 독립 실행형으로 사용할 수 있습니다.

첫 번째 빌드 및 실행

IronPdfEngine 바이너리 파일은 프로젝트를 처음 실행할 때 자동으로 다운로드됩니다. IronPdfEngine 프로세스는 IronPdf 함수를 처음 호출할 때 시작되고, 애플리케이션이 종료되거나 유휴 상태가 되면 중지됩니다.

IronPDF 엔진을 Maven 종속성으로 설치하세요.

IronPdfEngine을 Maven 종속성으로 추가하면 종속성 로드 중에 바이너리가 다운로드됩니다.

  • 이 방법을 사용하면 IronPdfEngine 바이너리가 이미 다운로드되어 있으므로 시작 과정이 길어지는 것을 방지할 수 있습니다.
  • 또한, 외부 소스에서 다운로드를 허용하지 않는 배포 환경에 유용할 것입니다.

멀티플랫폼 앱을 개발하는 경우 pom.xml 파일에 다음 코드 조각 중 하나 이상을 추가하기만 하면 됩니다.

Windows x64용

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

Windows x86용

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x86</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x86</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

Linux x64용

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-linux-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-linux-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

macOS x64(인텔)용

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

macOS Arm(애플 실리콘)용

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-arm64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-arm64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

자바 코드 작성을 시작하세요

종속성이 정의되면 Java 코드 맨 위에 import com.ironsoftware.ironpdf.* 문을 추가하여 시작할 수 있습니다. 다음은 시작하는 데 도움이 되는 간단한 HTML-PDF 변환 예제입니다.

// Import statement for IronPDF Java
import com.ironsoftware.ironpdf.*;

// Apply your license key
License.setLicenseKey("YOUR-LICENSE-KEY");

// Set a log path
Settings.setLogPath(Paths.get("C:/tmp/IronPdfEngine.log"));

// Render the HTML as a PDF. Stored in myPdf as type PdfDocument
PdfDocument myPdf = PdfDocument.renderHtmlAsPdf("<h1> ~Hello World~ </h1> Made with IronPDF!");

// Save the PdfDocument to a file
myPdf.saveAs(Paths.get("html_saved.pdf"));
// Import statement for IronPDF Java
import com.ironsoftware.ironpdf.*;

// Apply your license key
License.setLicenseKey("YOUR-LICENSE-KEY");

// Set a log path
Settings.setLogPath(Paths.get("C:/tmp/IronPdfEngine.log"));

// Render the HTML as a PDF. Stored in myPdf as type PdfDocument
PdfDocument myPdf = PdfDocument.renderHtmlAsPdf("<h1> ~Hello World~ </h1> Made with IronPDF!");

// Save the PdfDocument to a file
myPdf.saveAs(Paths.get("html_saved.pdf"));
JAVA

이것은 URL을 PDF로 변환하는 방법을 보여주는 또 다른 간단한 예입니다.

// Import statement for IronPDF Java
import com.ironsoftware.ironpdf.*;

// Apply your license key
License.setLicenseKey("YOUR-LICENSE-KEY");

// Set a log path
Settings.setLogPath(Paths.get("C:/tmp/IronPdfEngine.log"));

// Render the URL as a PDF. Stored in myPdf as type PdfDocument
PdfDocument myPdf = PdfDocument.renderUrlAsPdf("https://ironpdf.com/java");

// Save the PdfDocument to a file
myPdf.saveAs(Paths.get("url_saved.pdf"));
// Import statement for IronPDF Java
import com.ironsoftware.ironpdf.*;

// Apply your license key
License.setLicenseKey("YOUR-LICENSE-KEY");

// Set a log path
Settings.setLogPath(Paths.get("C:/tmp/IronPdfEngine.log"));

// Render the URL as a PDF. Stored in myPdf as type PdfDocument
PdfDocument myPdf = PdfDocument.renderUrlAsPdf("https://ironpdf.com/java");

// Save the PdfDocument to a file
myPdf.saveAs(Paths.get("url_saved.pdf"));
JAVA

Main.java 전체 예제

package org.example;

// Import statement for IronPDF Java
import com.ironsoftware.ironpdf.*;
import java.io.IOException;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws IOException {
        // Apply your license key
        License.setLicenseKey("YOUR-LICENSE-KEY");

        // Set a log path
        Settings.setLogPath(Paths.get("C:/tmp/IronPdfEngine.log"));

        // Render the HTML as a PDF. Stored in myPdf as type PdfDocument
        PdfDocument myPdf = PdfDocument.renderHtmlAsPdf("<h1> ~Hello World~ </h1> Made with IronPDF!");

        // Save the PdfDocument to a file
        myPdf.saveAs(Paths.get("html_saved.pdf"));

    }

}
package org.example;

// Import statement for IronPDF Java
import com.ironsoftware.ironpdf.*;
import java.io.IOException;
import java.nio.file.Paths;

public class Main {

    public static void main(String[] args) throws IOException {
        // Apply your license key
        License.setLicenseKey("YOUR-LICENSE-KEY");

        // Set a log path
        Settings.setLogPath(Paths.get("C:/tmp/IronPdfEngine.log"));

        // Render the HTML as a PDF. Stored in myPdf as type PdfDocument
        PdfDocument myPdf = PdfDocument.renderHtmlAsPdf("<h1> ~Hello World~ </h1> Made with IronPDF!");

        // Save the PdfDocument to a file
        myPdf.saveAs(Paths.get("html_saved.pdf"));

    }

}
JAVA

추가 설정 정보

참고: 모든 설정, 로깅 및 라이선스 작업은 IronPDF 메서드를 호출하기 전에 완료해야 합니다.

라이선스 키 적용

라이선스 키를 적용하려면 메서드 맨 위에 다음 내용을 추가하세요.

com.ironsoftware.ironpdf.License.setLicenseKey("YOUR-LICENSE-KEY");
com.ironsoftware.ironpdf.License.setLicenseKey("YOUR-LICENSE-KEY");
JAVA

벌채 반출

IronPDF Java는 로깅 목적으로 slf4j 로거를 사용합니다. 로깅을 활성화하려면 다음을 사용하십시오.

com.ironsoftware.ironpdf.Settings.setDebug(true);
com.ironsoftware.ironpdf.Settings.setDebug(true);
JAVA

IronPdfEngine 로그 경로를 지정하려면 다음을 추가하세요.

com.ironsoftware.ironpdf.Settings.setLogPath(Paths.get("C:/tmp/myIronPdfEngineLog.log"));
com.ironsoftware.ironpdf.Settings.setLogPath(Paths.get("C:/tmp/myIronPdfEngineLog.log"));
JAVA

라이선스 및 지원 가능

실제 프로젝트에서 IronPDF를 사용하려면 라이선스를 구매하세요 . 체험 사용자를 위해 30일 평가판 라이선스도 제공됩니다.

전체 코드 예제, 튜토리얼, 라이선스 정보 및 문서 목록을 보려면 IronPDF for Java 리소스 페이지 를 방문하세요.

더 자세한 지원이나 문의 사항이 있으시면 고객 지원팀으로 연락해 주세요.

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.

시작할 준비 되셨나요?
버전: 2026.2 방금 출시되었습니다