Rozpocznij pracę z IronPrint
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.
Biblioteka drukowania C#
- Pobierz bibliotekę C# do drukowania dokumentów
- Obsługa formatów PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGE, BITMAP
- Dostosuj ustawienia drukowania
- Pokaż okno dialogowe przed drukowaniem
- Odkrywaj funkcje biblioteki za darmo w C#
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"
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
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
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
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.

