# Introducción a IronPrint
## IronPrint: su biblioteca de impresión todo en uno para .NET
**IronPrint** es una biblioteca de impresión desarrollada por Iron Software. La biblioteca es compatible con una amplia variedad de entornos, incluidos Windows, macOS, Android y iOS.
<div class="hsg-featured-snippet">
<h2>Biblioteca C#</h2>
<ol>
<li><a href="https://www.nuget.org/packages/IronPrint/">Descargue la biblioteca C# para imprimir documentos</a></li>
<li>Maneja formatos PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGEN, MAPA DE BITS</li>
<li>Personalizar la configuración de impresión</li>
<li>Mostrar diálogo antes de imprimir</li>
<li>Explora las características de la biblioteca de forma gratuita en C#</li>
</ol>
</div>
### Compatibilidad
**IronPrint** tiene compatibilidad de soporte multiplataforma con:
#### Compatibilidad con versiones .NET
- **C#**, **VB.NET**, **F#**
- **.NET 8, 7**, 6, 5 y Core 3.1+
- .NET Framework (4.6.2+)
#### Soporte de sistemas operativos y entornos
- **Windows** (7+, Server 2016+)
- **macOS** (10+)
- **iOS** (11+)
- **Android** API 21+ (v5 "Lollipop")
#### Compatibilidad con tipos de proyectos .NET
- **Móvil** (Xamarin & MAUI & Avalonia)
- **Escritorio** (WPF & MAUI & Windows Avalonia)
- **Consola** (Aplicación y Biblioteca)
## Instalación
### Biblioteca IronPrint
Instale el paquete IronPrint a través del Administrador de Paquetes NuGet:
```shell
:InstallCmd dotnet add package IronPrint
```
Alternativamente, descargue directamente desde el [sitio web oficial de IronPrint NuGet](https://www.nuget.org/packages/IronPrint).
Una vez instalado, puede comenzar agregando `using IronPrint;` al inicio de su código C#.
## Aplicar clave de licencia
A continuación, aplique una licencia válida o clave de prueba a IronPrint asignando la clave de licencia a la propiedad `LicenseKey` de la clase `License`. Incluya el siguiente código justo después de la declaración de importación, antes de usar cualquier método de IronPrint:
```csharp
using IronPrint;
// Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here";
```
## Ejemplos de código
### Imprimir documento
Simplemente pase la ruta del archivo al método `Print` para imprimir el documento.
```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);
}
}
```
### Imprimir con diálogo
Utilice el método `ShowPrintDialog` para imprimir el documento, el cual también muestra el cuadro de diálogo de impresión antes de imprimir.
```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);
}
}
```
### Personalizar la configuración de impresión
Para configurar los ajustes de impresión desde el código, instancie la clase `PrintSettings`. Configure el objeto `PrintSettings` y páselo a uno de los métodos de impresión.
```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);
}
}
```
## Licencias y soporte disponibles
**IronPrint** es una biblioteca paga; sin embargo, también están disponibles licencias de prueba gratuitas [aquí](trial-license).
Para obtener más información sobre Iron Software, visite nuestro sitio web: [https://ironsoftware.com/](https://ironsoftware.com/) Para más soporte y consultas, por favor [pregunte a nuestro equipo](/contact-us/).
### Soporte de Iron Software
Para soporte general y consultas técnicas, envíenos un correo electrónico a: [support@ironsoftware.com](mailto:support@ironsoftware.com).
IronPrint: su biblioteca de impresión todo en uno para .NET
IronPrint es una biblioteca de impresión desarrollada por Iron Software. La biblioteca es compatible con una amplia variedad de entornos, incluidos Windows, macOS, Android y iOS.
Una vez instalado, puede comenzar agregando using IronPrint; al inicio de su código C#.
Aplicar clave de licencia
A continuación, aplique una licencia válida o clave de prueba a IronPrint asignando la clave de licencia a la propiedad LicenseKey de la clase License. Incluya el siguiente código justo después de la declaración de importación, antes de usar cualquier método de 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"
Ejemplos de código
Imprimir documento
Simplemente pase la ruta del archivo al método Print para imprimir el documento.
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
Imprimir con diálogo
Utilice el método ShowPrintDialog para imprimir el documento, el cual también muestra el cuadro de diálogo de impresión antes de imprimir.
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
Personalizar la configuración de impresión
Para configurar los ajustes de impresión desde el código, instancie la clase PrintSettings. Configure el objeto PrintSettings y páselo a uno de los métodos de impresión.
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
Licencias y soporte disponibles
IronPrint es una biblioteca paga; sin embargo, también están disponibles licencias de prueba gratuitas aquí.
Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien estructurados y visualmente atractivos.