Introducción a IronPrint

This article was translated from English: Does it need improvement?
Translated
View the article in English

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.

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 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"
$vbLabelText   $csharpLabel

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
$vbLabelText   $csharpLabel

Use el método ShowPrintDialog para imprimir el documento, que también muestra el 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
$vbLabelText   $csharpLabel

Personalizar la configuración de impresión

Para configurar la configuración 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 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
$vbLabelText   $csharpLabel

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.

Curtis Chau
Escritor Técnico

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 ...

Leer más
¿Listo para empezar?
Nuget Descargas 34,704 | Version: 2025.11 recién lanzado