IronPrintを使い始める

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

IronPrint: .NET 向けオールインワン印刷ライブラリ

IronPrint は、Iron Software によって開発された印刷ライブラリです。 このライブラリは、Windows、macOS、Android、iOS など、さまざまな環境と互換性があります。

互換性

IronPrint は、以下のプラットフォームとのクロスプラットフォーム サポート互換性を備えています。

.NET バージョンのサポート

  • C#VB.NETF#
  • .NET 8、7、6、5 、および Core 3.1 以上
  • .NET Framework (4.6.2+)

オペレーティングシステムと環境のサポート

  • Windows (7以降、Server 2016以降)
  • macOS (10+)
  • iOS (11以上)
  • Android API 21+ (v5 "Lollipop")

.NET プロジェクトタイプのサポート

-モバイル(Xamarin & MAUI & Avalonia) -デスクトップ(WPF & MAUI & Windows Avalonia)

  • コンソール (App & ライブラリ)

インストール

IronPrintライブラリ

NuGet パッケージ マネージャーを使用して IronPrint パッケージをインストールします。

dotnet add package IronPrint

または、公式の IronPrint NuGet Web サイトから直接ダウンロードすることもできます。

インストールが完了したら、C# コードの先頭に using IronPrint; を追加して使用を開始できます。

ライセンスキーの適用

次に、LicenseKey クラスの License プロパティにライセンスキーを割り当てることで、IronPrint に有効なライセンスまたは試用キーを適用します。 IronPrint メソッドを使用する前に、import ステートメントの直後に次のコードを含めます。

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

コード例

文書を印刷

Print メソッドにファイルパスを渡すだけで、ドキュメントを PRINT できます。

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

ダイアログ付き印刷

ShowPrintDialog メソッドを使用してドキュメントを印刷します。これにより、印刷前に印刷ダイアログも表示されます。

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

印刷設定をカスタマイズする

コードからPRINT設定を行うには、PrintSettings クラスをインスタンス化してください。 PrintSettings オブジェクトを設定し、それをいずれかの PRINT メソッドに渡します。

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

ライセンスとサポートの提供

IronPrintは有料ライブラリです。 ただし、無料のトライアルライセンスもこちらで利用可能です。

Iron Software の詳細については、当社の Web サイトをご覧ください。https://ironsoftware.com/さらにサポートやお問い合わせが必要な場合は、当社のチームにお問い合わせください。

Iron Software からのサポート

一般的なサポートや技術的なお問い合わせについては、以下のメールアドレスまでご連絡ください。support@ironsoftware.com

カーティス・チャウ
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はできましたか?
Nuget ダウンロード 41,154 | バージョン: 2026.5 just released
Still Scrolling Icon

まだスクロールしていますか?

すぐに証拠が欲しいですか? PM > Install-Package IronPrint
サンプルを実行する プリンターに出力されるドキュメントを見る。