Rozpocznij pracę z IronPrint

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

IronPrint: Twoja wszechstronna biblioteka drukowania dla .NET

IronPrint to biblioteka do drukowania opracowana przez Iron Software. Biblioteka jest kompatybilna z szeroką gamą środowisk, w tym Windows, macOS, Android i iOS.

Kompatybilność

IronPrint ma wsparcie dla kompatybilności międzyplatformowej z:

Wsparcie dla wersji .NET

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

Wsparcie dla systemów operacyjnych i środowisk

  • Windows (7+, Server 2016+)
  • macOS (10+)
  • iOS (11+)
  • Android API 21+ (wersja 5 "Lollipop")

Wsparcie dla typów projektów .NET

  • Mobilne (Xamarin & MAUI & Avalonia)
  • Desktopowe (WPF & MAUI & Windows Avalonia)
  • Konsolowe (Aplikacja & Biblioteka)

Instalacja

Biblioteka IronPrint

Zainstaluj pakiet IronPrint za pomocą Menedżera pakietów NuGet:

dotnet add package IronPrint

Alternatywnie, pobierz bezpośrednio z oficjalnej strony IronPrint w serwisie NuGet.

Po zainstalowaniu możesz rozpocząć pracę, dodając using IronPrint; na początku kodu C#.

Stosowanie klucza licencyjnego

Następnie zastosuj ważną licencję lub klucz próbny do IronPrint, przypisując klucz licencyjny do właściwości LicenseKey klasy License. Zawierać następujący kod zaraz po instrukcji importu, przed użyciem jakichkolwiek metod IronPrint:

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

Przykłady kodu

Drukuj Dokument

Wystarczy przekazać ścieżkę do pliku do metody Print, aby wydrukować dokument.

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

Drukuj z dialogiem

Użyj metody ShowPrintDialog, aby wydrukować dokument, co spowoduje również wyświetlenie okna dialogowego PRINT przed rozpoczęciem drukowania.

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

Dostosuj Ustawienia Drukowania

Aby skonfigurować ustawienia drukowania z poziomu kodu, należy utworzyć instancję klasy PrintSettings. Skonfiguruj obiekt PrintSettings i przekaż go do jednej z metod PRINT.

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

Licencjonowanie i wsparcie dostępne

IronPrint to płatna biblioteka; jednakże, darmowe licencje próbne są również dostępne tutaj.

Więcej informacji o Iron Software znajdziesz na naszej stronie internetowej: https://ironsoftware.com/ Więcej wsparcia i zapytań: zapytaj nasz zespół.

Wsparcie od Iron Software

W przypadku ogólnego wsparcia i zapytań technicznych, napisz do nas e-mail: support@ironsoftware.com.

Curtis Chau
Autor tekstów technicznych

Curtis Chau posiada tytuł licencjata z informatyki (Uniwersytet Carleton) i specjalizuje się w front-endowym rozwoju, z ekspertką w Node.js, TypeScript, JavaScript i React. Pasjonuje się tworzeniem intuicyjnych i estetycznie przyjemnych interfejsów użytkownika, Curtis cieszy się pracą z nowoczesnymi frameworkami i tworzeniem dobrze zorganizowanych, atrakcyjnych wizualnie podrę...

Czytaj więcej
Gotowy, aby rozpocząć?
Nuget Pliki do pobrania 41,154 | Wersja: 2026.5 just released
Still Scrolling Icon

Wciąż przewijasz?

Czy chcesz szybko dowodu? PM > Install-Package IronPrint
uruchom próbkę obserwuj, jak twój dokument trafia do drukarki.