Java용 IronPDF - Java 애플리케이션에서 PDF를 생성, 편집 및 읽기
Java용 IronPDF 소개
IronPDF for Java는 Iron Software 에서 개발 및 유지 관리하는 라이브러리로, 소프트웨어 엔지니어가 Java 8+, Kotlin 및 Scala 프로젝트에서 PDF 콘텐츠를 생성, 편집 및 추출할 수 있도록 지원합니다.
IronPDF for Java는 IronPDF for .NET의 성공과 인기를 바탕으로 구축되었습니다.
IronPDF for Java는 IronPdfEngine와 통신하기 위해 gRPC를 사용합니다.
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>
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>
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>
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>
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>
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>
Java 코드 작성을 시작하세요
종속성을 정의하면 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"));
이것은 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"));
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"));
}
}
추가 설정 정보
참고: 모든 설정, 로깅 및 라이선스 작업은 IronPDF 메서드를 호출하기 전에 완료해야 합니다.
라이선스 키 적용
라이선스 키를 적용하려면 메서드 맨 위에 다음 내용을 추가하세요.
com.ironsoftware.ironpdf.License.setLicenseKey("YOUR-LICENSE-KEY");
com.ironsoftware.ironpdf.License.setLicenseKey("YOUR-LICENSE-KEY");
벌채 반출
IronPDF Java는 로깅 목적으로 slf4j 로거를 사용합니다. 로깅을 활성화하려면 다음을 사용하십시오.
com.ironsoftware.ironpdf.Settings.setDebug(true);
com.ironsoftware.ironpdf.Settings.setDebug(true);
IronPdfEngine 로그 경로를 지정하려면 다음을 추가하십시오:
com.ironsoftware.ironpdf.Settings.setLogPath(Paths.get("C:/tmp/myIronPdfEngineLog.log"));
com.ironsoftware.ironpdf.Settings.setLogPath(Paths.get("C:/tmp/myIronPdfEngineLog.log"));
라이선스 및 지원 가능
실제 프로젝트에서 IronPDF 사용하려면 라이선스를 구매하세요 . 체험 사용자를 위해 30일 평가판 라이선스도 제공됩니다.
전체 코드 예제, 튜토리얼, 라이선스 정보 및 문서 목록을 보려면 IronPDF for Java 리소스 페이지 를 방문하세요.
더 자세한 지원이나 문의 사항이 있으시면 고객 지원팀으로 연락해 주세요.

