Primeiros passos com o IronPrint
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.
Biblioteca de impressão em C#
- Baixe a biblioteca C# para imprimir documentos.
- Suporta formatos PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGE e BITMAP.
- Personalize as configurações de impressão
- Exibir diálogo antes de imprimir
- Explore gratuitamente os recursos da biblioteca em C#.
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";
Imports IronPrint
' Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here"
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);
}
}
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 com caixa de diálogo
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);
}
}
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 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);
}
}
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
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 .

