Premiers pas avec IronPrint
IronPrint : Votre bibliothèque d'impression tout-en-un for .NET
IronPrint est une bibliothèque d'impression développée par Iron Software. La bibliothèque est compatible avec une grande variété d'environnements, notamment Windows, macOS, Android et iOS.
Bibliothèque d'impression C#
- Téléchargez la bibliothèque C# pour imprimer des documents
- Prise en charge des formats PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGE et BITMAP
- Personnaliser les paramètres d'impression
- Afficher la boîte de dialogue avant l'impression
- Explorez gratuitement les fonctionnalités de la bibliothèque en C#
Compatibilité
IronPrint est compatible avec plusieurs plateformes :
Prise en charge des versions .NET
- C# , VB.NET , F#
- .NET 8, 7 , 6, 5 et Core 3.1+
- .NET Framework (4.6.2+)
Support des systèmes d'exploitation et des environnements
- Windows (7+, Server 2016+)
- macOS (10+)
- iOS (11+)
- Android API 21+ (v5 " Lollipop ")
Prise en charge des types de projets .NET
- Mobile (Xamarin, MAUI et Avalonia)
- Bureau (WPF, MAUI et Windows Avalonia)
- Console (Applications et bibliothèque)
Installation
Bibliothèque IronPrint
Installez le package IronPrint via le gestionnaire de packages NuGet :
dotnet add package IronPrint
Vous pouvez également télécharger directement depuis le site Web officiel d'IronPrint NuGet .
Une fois installé, vous pouvez commencer en ajoutant using IronPrint; au sommet de votre code C#.
Application de la clé de licence
Ensuite, appliquez une licence ou une clé d'essai valide à IronPrint en attribuant la clé de licence à la propriété LicenseKey de la classe License. Insérez le code suivant juste après l'instruction d'importation, avant d'utiliser les méthodes 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"
Exemples de code
Imprimer le document
Il suffit de passer le chemin du fichier à la méthode Print pour imprimer le document.
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
Imprimer avec boîte de dialogue
Utilisez la méthode ShowPrintDialog pour imprimer le document, qui affiche également la boîte de dialogue d'impression avant l'impression.
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
Personnaliser les paramètres d'impression
Pour configurer les paramètres d'impression à partir du code, instanciez la classe PrintSettings. Configurez l'objet PrintSettings et transmettez-le à l'une des méthodes d'impression.
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
Licence et support disponibles
IronPrint est une bibliothèque payante, cependant des licences d'essai gratuites sont également disponibles ici .
Pour plus d'informations sur Iron Software, veuillez consulter notre site web :https://ironsoftware.com/ Pour plus d'assistance et pour toute question, veuillez contacter notre équipe .
Assistance d'Iron Software
Pour toute assistance générale et questions techniques, veuillez nous contacter par e-mail à l'adresse suivante :support@ironsoftware.com .

