# Premiers pas avec IronPrint
## IronPrint : Votre bibliothèque d'impression tout-en-un pour .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.
<div class="hsg-featured-snippet">
<h2>Bibliothèque d'impression C#</h2>
<ol>
<li><a href="https://www.nuget.org/packages/IronPrint/">Téléchargez la bibliothèque C# pour imprimer des documents</a></li>
<li>Prise en charge des formats PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGE et BITMAP</li>
<li>Personnaliser les paramètres d'impression</li>
<li>Afficher la boîte de dialogue avant l'impression</li>
<li>Explorez gratuitement les fonctionnalités de la bibliothèque en C#</li>
</ol>
</div>
### 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 :
```shell
:InstallCmd dotnet add package IronPrint
```
Vous pouvez également télécharger directement depuis le [site Web officiel d'IronPrint NuGet](https://www.nuget.org/packages/IronPrint) .
Une fois installé, vous pouvez commencer en ajoutant `using IronPrint;` en haut de votre code C#.
## Application de la clé de licence
Ensuite, appliquez une clé de licence valide ou une clé d'essai à 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 :
```csharp
using 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.
```csharp
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);
}
}
```
### 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.
```csharp
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);
}
}
```
### 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 passez-le à l'une des méthodes d'impression.
```csharp
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);
}
}
```
## Licence et support disponibles
**IronPrint** est une bibliothèque payante ; cependant, des licences d'essai gratuites sont également disponibles [ici](trial-license).
Pour plus d'informations sur Iron Software, veuillez consulter notre site web :[https://ironsoftware.com/](https://ironsoftware.com/) Pour plus d'assistance et pour toute question, veuillez [contacter notre équipe](/contact-us/) .
### 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](mailto:support@ironsoftware.com) .
IronPrint : Votre bibliothèque d'impression tout-en-un pour .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.
Une fois installé, vous pouvez commencer en ajoutant using IronPrint; en haut de votre code C#.
Application de la clé de licence
Ensuite, appliquez une clé de licence valide ou une clé d'essai à 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 hereLicense.LicenseKey = "your-license-key-here";
using IronPrint;
// Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here";
ImportsIronPrint' Apply your IronPrint license key hereLicense.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 voidMain() { // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the Print method to print the documentIronPrint.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);
}
}
ImportsIronPrintFriend Class ProgramShared Sub Main() ' Specify the file path to be printed Dim filePath AsString = "document.pdf" ' Invoke the Print method to print the documentIronPrint.Print(filePath) End SubEnd Class
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 voidMain() { // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the ShowPrintDialog method to prompt the dialog before printingIronPrint.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);
}
}
ImportsIronPrintFriend Class ProgramShared Sub Main() ' Specify the file path to be printed Dim filePath AsString = "document.pdf" ' Invoke the ShowPrintDialog method to prompt the dialog before printingIronPrint.ShowPrintDialog(filePath) End SubEnd Class
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 passez-le à l'une des méthodes d'impression.
using IronPrint;class Program{ static voidMain() { // 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 settingsIronPrint.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);
}
}
ImportsIronPrintFriend Class ProgramShared Sub Main() ' Create a PrintSettings object to configure printer settings Dim settings As New PrintSettingsWith { .Copies = 2, .Duplex = DuplexMode.Vertical, .PageOrientation = PageOrientation.Landscape } ' Specify the file path to be printed Dim filePath AsString = "document.pdf" ' Invoke the Print method with custom print settingsIronPrint.Print(filePath, settings) End SubEnd Class
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.
Curtis Chau détient un baccalauréat en informatique (Université de Carleton) et se spécialise dans le développement front-end avec expertise en Node.js, TypeScript, JavaScript et React. Passionné par la création d'interfaces utilisateur intuitives et esthétiquement plaisantes, Curtis aime travailler avec des frameworks modernes et créer des manuels bien structurés et visuellement attrayants.