Getting Started with IronPrint

IronPrint: Your All-in-One Print Library for .NET

IronPrint is a print library developed by Iron Software. The library is compatible with a wide variety of environments, including Windows, macOS, Android, and iOS.

Compatibility

IronPrint has cross-platform support compatibility with:

.NET Version Support

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

Operating Systems and Environments Support

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

.NET Project Types Support

  • Mobile (Xamarin & MAUI & Avalonia)
  • Desktop (WPF & MAUI & Windows Avalonia)
  • Console (App & Library)

Installation

IronPrint Library

Install the IronPrint package via NuGet Package Manager:

dotnet add package IronPrint

Alternatively, download directly from the official IronPrint NuGet website.

Once installed, you can get started by adding using IronPrint; to the top of your C# code.

Applying License Key

Next, apply a valid license or trial key to IronPrint by assigning the license key to the LicenseKey property of the License class. Include the following code right after the import statement, before using any IronPrint methods:

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

Code Examples

Print Document

Simply pass the file path to the Print method to print the document.

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

Print With Dialog

Use the ShowPrintDialog method to print the document, which also shows the print dialog before printing.

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

Customize Print Settings

To configure the print settings from the code, instantiate the PrintSettings class. Configure the PrintSettings object and pass it to one of the print methods.

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

Licensing & Support Available

IronPrint is a paid library, however, free trial licenses are also available here.

For more information about Iron Software, please visit our website: https://ironsoftware.com/ For more support and inquiries, please ask our team.

Support from Iron Software

For general support and technical inquiries, please email us at: support@ironsoftware.com.