Introducción a IronPrint
IronPrint: su biblioteca de impresión todo en uno for .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.
Biblioteca C#
- Descargue la biblioteca C# para imprimir documentos
- Maneja formatos PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGEN, MAPA DE BITS
- Personalizar la configuración de impresión
- Mostrar diálogo antes de imprimir
- Explora las características de la biblioteca de forma gratuita en C#
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:
dotnet add package IronPrint
Alternativamente, descargue directamente desde el sitio web oficial de IronPrint NuGet.
Una vez instalado, puede comenzar agregando using IronPrint; en la parte superior de su código C#.
Aplicar clave de licencia
A continuación, aplique una licencia válida o una 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 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"
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 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
Imprimir con diálogo
Utilice el método ShowPrintDialog para imprimir el documento, que también muestra el cuadro de diálogo de impresión antes de imprimir.
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
Personalizar la configuración de impresión
Para configurar los ajustes de impresión desde el código, cree una instancia de la clase PrintSettings. Configure el objeto PrintSettings y páselo a uno de los métodos de impresión.
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
Licencias y soporte disponibles
IronPrint es una biblioteca de pago, sin embargo, también están disponibles licencias de prueba gratuitas aquí.
Para obtener más información sobre Iron Software, visite nuestro sitio web: https://ironsoftware.com/ Para más soporte y consultas, por favor pregunte a nuestro equipo.
Soporte de Iron Software
Para soporte general y consultas técnicas, envíenos un correo electrónico a: support@ironsoftware.com.

