IronPDF Java için - Java Uygulamalarında PDF Oluşturma, Düzenleme ve Okuma

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

IronPDF Java için Hakkında

IronPDF for Java, Yazılım Mühendislerine Java 8+, Kotlin ve Scala projelerinde PDF içeriği oluşturma, düzenleme ve çıkarma konularında yardımcı olan, Iron Software tarafından geliştirilen ve sürdürülen bir kütüphanedir.

IronPDF for Java, IronPDF for .NET'in başarısı ve popülaritesini temel alır.

IronPDF for Java, IronPdfEngine ile iletişim kurmak için gRPC kullanır.

IronPDF'nin Öne Çıktığı Noktalar

  • PDF oluşturma: HTML, URL, JavaScript, CSS ve birçok görüntü formatından
  • Başlık/alt bilgi ekleme, imzalar, ekler, şifreler ve güvenlik ekleme
  • Performans optimizasyonu: Tam Multithreading ve Asenkron destek
  • Ve daha birçok şey! Tüm kod örneklerimizi ve 50'den fazla özelliğimizin tam listesini görmek için web sitemizi ziyaret edin.

IronPDF Java için Kullanımı

IronPDF'i Java Bağımlılığı Olarak Tanımlayın

pom.xml Bağımlılığı

IronPDF'yi bir bağımlılık olarak tanımlamak için lütfen pom.xml dosyanıza aşağıdakileri ekleyin:

<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 dosyasını indir

Opsiyonel olarak IronPDF JAR dosyasını manuel olarak indir bağımsız kullanım için.

İlk Kez Derleme ve Çalıştırma

IronPdfEngine ikili dosyaları, proje ilk kez çalıştırıldığında otomatik olarak indirilecektir. IronPdfEngine işlemi, herhangi bir IronPDF işlevini ilk kez çağırdığınızda başlayacak ve uygulamanız kapatıldığında veya boşta kalma aşamasına girdiğinde duracaktır.

Maven Bağımlılığı Olarak IronPDF Motorunu Yükle

IronPdfEngine'i bir Maven bağımlılığı olarak ekleyerek, ikili dosyalar bağımlılıkların yüklenmesi sırasında indirilecektir:

  • Bu yaklaşım, IronPdfEngine ikili dosyalarının zaten indirileceği için uzun süren bir başlatma sürecinden kaçınacaktır.
  • Ayrıca, dış kaynaklardan indirmeye izin vermeyen dağıtım kurulumları için faydalı olacaktır.

Eğer çoklu platformlu bir uygulama üzerinde çalışıyorsanız, pom.xml dosyanıza aşağıdaki kod kesitlerinden bir veya birkaçını ekleyin:

Windows x64 için

<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 için

<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 için

<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 (Intel) için

<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 (Apple Silicon) için

<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 Kodunu Yazmaya Başlayın

Bağımlılık tanımlandıktan sonra, Java kodunuzun başına import com.ironsoftware.ironpdf.* ifadesini ekleyerek başlayabilirsiniz. Başlangıç için basit bir HTML'den PDF'ye örnek burada:

// 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

Bu, URL'den PDF'ye dönüştürmeyi gösteren başka bir basit örnek:

// 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

Tam Main.java Örneği

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

Daha Fazla Ayar Bilgisi

Not: Tüm ayarların, günlük ve lisanslama işlemlerinin herhangi bir IronPDF metodunun çağrılmasından önce yapılması gerektiğini unutmayın.

Lisans Anahtarını Uygulama

Lisans anahtarınızı uygulamak için, metodunuzun üst kısmına aşağıdakileri ekleyin:

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

Günlük Kaydı

IronPDF Java, günlükleme amacıyla slf4j logger kullanır. Günlükleme'yi etkinleştirmek için kullanın:

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

IronPdfEngine günlük yolunu belirtmek için şunu ekleyin:

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

Lisanslama ve Destek Mevcuttur

IronPDF için canlı projelerde kullanılmak üzere bir lisans satın alın. Deneme kullanıcıları için 30 günlük Deneme lisansları da mevcuttur.

Tüm kod örneklerimizin, öğreticilerimizin, lisans bilgimizin ve belgelerimizin tam listesi için ziyaret edin: IronPDF Java için kaynakları.

Daha fazla destek ve sorular için, lütfen destek ekibimizle iletişime geçin.

Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapı...

Daha Fazla Oku
Başlamaya Hazır mısınız?
Sürüm: 2026.5 just released
Still Scrolling Icon

Hâlâ Kaydırıyor Musunuz?

Hızlıca kanıt ister misiniz?
bir örnek çalıştır HTML'nizi bir PDF'ye dönüştüğünü izleyin.