Primeiros passos com o IronPrint

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

IronPrint: Sua biblioteca de impressão completa for .NET

IronPrint é uma biblioteca de impressão desenvolvida pela Iron Software. A biblioteca é compatível com uma ampla variedade de ambientes, incluindo Windows, macOS, Android e iOS.

Compatibilidade

O IronPrint possui compatibilidade multiplataforma com:

Suporte à versão .NET

  • C# , VB .NET , F#
  • .NET 8, 7 , 6, 5 e Core 3.1+
  • .NET Framework (4.6.2 ou superior)

Suporte a sistemas operacionais e ambientes

  • Windows (7+, Server 2016+)
  • macOS (10+)
  • iOS (11+)
  • Android API 21+ (v5 "Lollipop")

Suporte a tipos de projeto .NET

  • Dispositivos móveis (Xamarin, Maui e Avalonia)
  • Área de trabalho (WPF, MAUI e Windows Avalonia)
  • Console (Aplicativo e Biblioteca)

Instalação

Biblioteca IronPrint

Instale o pacote IronPrint através do Gerenciador de Pacotes NuGet :

dotnet add package IronPrint

Alternativamente, faça o download diretamente do site oficial do IronPrint no NuGet .

Uma vez instalado, você pode começar adicionando using IronPrint; no início do seu código C#.

Aplicando a chave de licença

Em seguida, aplique uma licença válida ou chave de teste ao IronPrint atribuindo a chave de licença à propriedade LicenseKey da classe License. Inclua o seguinte código logo após a declaração de importação, antes de usar qualquer método do 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";
$vbLabelText   $csharpLabel

Exemplos de código

Imprimir documento

Basta passar o caminho do arquivo para o método Print para imprimir o 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);
    }
}
$vbLabelText   $csharpLabel

Use o método ShowPrintDialog para imprimir o documento, que também exibe o diálogo de impressão 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);
    }
}
$vbLabelText   $csharpLabel

Personalizar configurações de impressão

Para configurar as configurações de impressão a partir do código, instancie a classe PrintSettings. Configure o objeto PrintSettings e passe-o para um dos métodos de impressão.

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);
    }
}
$vbLabelText   $csharpLabel

Licenciamento e suporte disponíveis

IronPrint é uma biblioteca paga, porém, licenças de avaliação gratuitas também estão disponíveis aqui .

Para obter mais informações sobre a Iron Software, visite nosso site:https://ironsoftware.com/ Para obter mais suporte e esclarecer dúvidas, entre em contato com nossa equipe .

Suporte da Iron Software

Para suporte geral e dúvidas técnicas, envie um e-mail para:support@ironsoftware.com .

Curtis Chau
Redator Técnico

Curtis Chau é bacharel em Ciência da Computação (Universidade Carleton) e se especializa em desenvolvimento front-end, com experiência em Node.js, TypeScript, JavaScript e React. Apaixonado por criar interfaces de usuário intuitivas e esteticamente agradáveis, Curtis gosta de trabalhar com frameworks modernos e criar manuais ...

Leia mais
Pronto para começar?
Nuget Downloads 38,093 | Versão: 2026.3 acaba de ser lançado
Still Scrolling Icon

Ainda está rolando a tela?

Quer provas rápidas? PM > Install-Package IronPrint
executar um exemplo Veja seu documento chegar à impressora.