Getting Started with IronPrint

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

IronPrint: Ihre All-In-One Druckbibliothek für .NET

IronPrint ist eine Druckbibliothek, die von Iron Software entwickelt wurde. Die Bibliothek ist kompatibel mit einer Vielzahl von Umgebungen, einschließlich Windows, macOS, Android und iOS.

class="hsg-featured-snippet">

C# Druckbibliothek

  1. Laden Sie die C#-Bibliothek herunter, um Dokumente zu drucken
  2. PDF-, PNG-, HTML-, TIFF-, GIF-, JPEG-, IMAGE-, BITMAP-Formate handhaben
  3. Druckeinstellungen anpassen
  4. Dialog vor dem Drucken anzeigen
  5. Entdecken Sie die Funktionen der Bibliothek kostenlos in C#

Kompatibilität

IronPrint hat plattformübergreifende Unterstützungskompatibilität mit:

.NET Version Unterstützung

  • C#, VB.NET, F#
  • .NET 8, 7, 6, 5, und Core 3.1+
  • .NET Framework (4.6.2+)

Unterstützung für Betriebssysteme und Umgebungen

  • Windows (7+, Server 2016+)
  • macOS (10+)
  • iOS (11+)
  • Android API 21+ (v5 „Lollipop“)

.NET Projekttypen Unterstützung

  • Mobil (Xamarin & MAUI & Avalonia)
  • Desktop (WPF & MAUI & Windows Avalonia)
  • Konsole (App & Bibliothek)

Installation

IronPrint Bibliothek

Installieren Sie das IronPrint-Paket über den NuGet-Paket-Manager:

dotnet add package IronPrint

Alternativ direkt von der offiziellen IronPrint NuGet-Website herunterladen.

Einmal installiert, können Sie beginnen, indem Sie using IronPrint; am Anfang Ihres C#-Codes hinzufügen.

Lizenzschlüssel anwenden

Anschließend können Sie einen gültigen Lizenz- oder Testschlüssel auf IronPrint anwenden, indem Sie ihn der LicenseKey-Eigenschaft der License-Klasse zuweisen. Fügen Sie den folgenden Code direkt nach der Importanweisung hinzu, bevor Sie IronPrint-Methoden verwenden:

using IronPrint;

// Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here";
using IronPrint;

// Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here";
Imports IronPrint

' Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here"
$vbLabelText   $csharpLabel

Beispiele für Code

Dokument drucken

Übergeben Sie einfach den Dateipfad an die Print-Methode, um das Dokument zu drucken.

using IronPrint;

class Program
{
    static void Main()
    {
        // Specify the file path to be printed
        string filePath = "document.pdf";

        // Invoke the Print method to print the document
        IronPrint.Print(filePath);
    }
}
using IronPrint;

class Program
{
    static void Main()
    {
        // Specify the file path to be printed
        string filePath = "document.pdf";

        // Invoke the Print method to print the document
        IronPrint.Print(filePath);
    }
}
Imports IronPrint

Friend Class Program
	Shared Sub Main()
		' Specify the file path to be printed
		Dim filePath As String = "document.pdf"

		' Invoke the Print method to print the document
		IronPrint.Print(filePath)
	End Sub
End Class
$vbLabelText   $csharpLabel

Drucken mit Dialogfeld

Verwenden Sie die ShowPrintDialog-Methode, um das Dokument zu drucken, das auch das Druckdialogfeld vor dem Drucken anzeigt.

using IronPrint;

class Program
{
    static void Main()
    {
        // Specify the file path to be printed
        string filePath = "document.pdf";

        // Invoke the ShowPrintDialog method to prompt the dialog before printing
        IronPrint.ShowPrintDialog(filePath);
    }
}
using IronPrint;

class Program
{
    static void Main()
    {
        // Specify the file path to be printed
        string filePath = "document.pdf";

        // Invoke the ShowPrintDialog method to prompt the dialog before printing
        IronPrint.ShowPrintDialog(filePath);
    }
}
Imports IronPrint

Friend Class Program
	Shared Sub Main()
		' Specify the file path to be printed
		Dim filePath As String = "document.pdf"

		' Invoke the ShowPrintDialog method to prompt the dialog before printing
		IronPrint.ShowPrintDialog(filePath)
	End Sub
End Class
$vbLabelText   $csharpLabel

Druckeinstellungen anpassen

Um die Druckeinstellungen aus dem Code zu konfigurieren, instanziieren Sie die PrintSettings-Klasse. Konfigurieren Sie das PrintSettings-Objekt und übergeben Sie es an eine der Druckmethoden.

using IronPrint;

class Program
{
    static void Main()
    {
        // Create a PrintSettings object to configure printer settings
        PrintSettings settings = new PrintSettings
        {
            Copies = 2,
            Duplex = DuplexMode.Vertical,
            PageOrientation = PageOrientation.Landscape
        };

        // Specify the file path to be printed
        string filePath = "document.pdf";

        // Invoke the Print method with custom print settings
        IronPrint.Print(filePath, settings);
    }
}
using IronPrint;

class Program
{
    static void Main()
    {
        // Create a PrintSettings object to configure printer settings
        PrintSettings settings = new PrintSettings
        {
            Copies = 2,
            Duplex = DuplexMode.Vertical,
            PageOrientation = PageOrientation.Landscape
        };

        // Specify the file path to be printed
        string filePath = "document.pdf";

        // Invoke the Print method with custom print settings
        IronPrint.Print(filePath, settings);
    }
}
Imports IronPrint

Friend Class Program
	Shared Sub Main()
		' Create a PrintSettings object to configure printer settings
		Dim settings As New PrintSettings With {
			.Copies = 2,
			.Duplex = DuplexMode.Vertical,
			.PageOrientation = PageOrientation.Landscape
		}

		' Specify the file path to be printed
		Dim filePath As String = "document.pdf"

		' Invoke the Print method with custom print settings
		IronPrint.Print(filePath, settings)
	End Sub
End Class
$vbLabelText   $csharpLabel

Lizenzierung & Support verfügbar

IronPrint ist eine kostenpflichtige Bibliothek, jedoch sind kostenlose Testlizenzen auch hier verfügbar.

Für weitere Informationen über Iron Software, besuchen Sie bitte unsere Website: https://ironsoftware.com/ Für Unterstützung und Anfragen, fragen Sie unser Team.

Unterstützung von Iron Software

Für allgemeinen Support und technische Anfragen senden Sie uns bitte eine E-Mail an: support@ironsoftware.com.

Curtis Chau
Technischer Autor

Curtis Chau hat einen Bachelor-Abschluss in Informatik von der Carleton University und ist spezialisiert auf Frontend-Entwicklung mit Expertise in Node.js, TypeScript, JavaScript und React. Leidenschaftlich widmet er sich der Erstellung intuitiver und ästhetisch ansprechender Benutzerschnittstellen und arbeitet gerne mit modernen Frameworks sowie der Erstellung gut strukturierter, optisch ansprechender ...

Weiterlesen
Bereit anzufangen?
Nuget Downloads 34,016 | Version: 2025.11 gerade veröffentlicht