比較

RawPrint .NET vs IronPDF:技術比較ガイド

.NET開発者がドキュメント印刷とPDF生成ソリューションを評価する場合、RawPrint .NETとIronPDFは根本的に異なるアプローチと機能を提供します。 RawPrint .NETはプリンタに直接rawバイトを送るためのプリンタスプーラへの低レベルアクセスを提供し、IronPDFはPDFドキュメントを作成、操作、印刷するための完全な高レベルAPIを提供します。 この技術比較では、.NETアプリケーションの文書処理を決定するプロの開発者やアーキテクトにとって最も重要な次元にわたって、両方のソリューションを検証します。

RawPrint.NETを理解する

RawPrint .NETは低レベルの印刷ユーティリティーで、生のバイトを直接プリンターのスプーラーに送ります。 従来のプリンタドライバをバイパスし、コマンドデータを直接プリンタに送信するアプリケーションを可能にします。 この機能は、ZPL(Zebra Programming Language)やEPL(Eltron Programming Language)を使用するラベルクリエーターなどの特殊プリンターに特に役立ちます。

重要な違い: RawPrint .NETはPDFライブラリではありません。 PDFドキュメントの作成、生成、レンダリング、操作は行いません。 その唯一の機能は、Windowsの印刷サブシステムを介したプリンタハードウェアへのバイト転送です。

このアプローチでは、開発者はwinspool.DrvからのWindows固有のDLLインポートで作業し、一連の関数呼び出しを通じて手動でプリンタハンドルを管理する必要があります:OpenPrinterStartDocPrinterStartPagePrinterWritePrinterEndPagePrinterEndDocPrinterClosePrinterです。

RawPrint .NETのアーキテクチャーは、プリンターコマンド言語の深い理解を要求します。 ドキュメントのフォーマットについては、開発者は、バイトストリームに埋め込まれたエスケープシーケンスとして、PCL(プリンタコマンド言語)またはPostScriptコマンドを手動で構築する必要があります。

IronPDFの理解

IronPDFは、.NETアプリケーションでのPDF操作のための完全な高レベルAPIを提供します。 このライブラリには、HTML、CSS、JavaScriptを完全に忠実にPDF文書に変換するChromiumベースのレンダリングエンジンが含まれています。 IronPDFは生成だけでなく、結合、分割、編集、セキュリティ機能を含むPDF操作機能を提供します。

IronPDFのアーキテクチャはドキュメントのレンダリングとプリンタ通信の複雑さを抽象化します。 ChromePdfRendererクラスはHTMLからPDFへの変換を処理し、PdfDocumentクラスは手動でのリソース管理を必要とせずに操作や印刷を行うメソッドを提供します。

コア能力の差

RawPrint .NETとIronPDFの基本的な違いは、その目的と機能にあります:

タスクRawPrint .NETIronPDF
HTMLからPDFを作成サポートされていませんはい
URLからPDFを作成サポートされていませんはい
PDFの編集/修正サポートされていませんはい
PDFのマージ/分割サポートされていませんはい
既存のPDFを印刷はい(生バイトのみ)はい(高レベルAPI)
印刷コントロール基本フルオプション
クロスプラットフォームWindowsのみはい

この比較から、RawPrint .NETとIronPDFは全く異なるユースケースに対応していることがわかります。 RawPrint .NETは低レベルのプリンター通信に対応し、IronPDFは完全なPDFドキュメントのライフサイクル管理を提供します。

HTMLからPDFへの変換

RawPrint .NETとIronPDFのコントラストは、HTMLからPDFへの変換シナリオを検討する際に顕著になります。

RawPrint .NETHTML ハンドリングについて

RawPrint .NETはHTMLをPDFに変換することは出来ません。 プリンターへの生データの送信のみ可能です:

// NuGet: Install-Package System.Drawing.Common
using System;
using System.Drawing;
using System.Drawing.Printing;
using System.Runtime.InteropServices;
using System.Text;

class RawPrinterHelper
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public class DOCINFOA
    {
        [MarshalAs(UnmanagedType.LPStr)] public string pDocName;
        [MarshalAs(UnmanagedType.LPStr)] public string pOutputFile;
        [MarshalAs(UnmanagedType.LPStr)] public string pDataType;
    }

    [DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);

    [DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool ClosePrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool StartDocPrinter(IntPtr hPrinter, Int32 level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);

    [DllImport("winspool.Drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EndDocPrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool StartPagePrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EndPagePrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);

    public static bool SendStringToPrinter(string szPrinterName, string szString)
    {
        IntPtr pBytes;
        Int32 dwCount;
        dwCount = szString.Length;
        pBytes = Marshal.StringToCoTaskMemAnsi(szString);
        IntPtr hPrinter;
        if (OpenPrinter(szPrinterName, out hPrinter, IntPtr.Zero))
        {
            DOCINFOA di = new DOCINFOA();
            di.pDocName = "HTML Document";
            di.pDataType = "RAW";
            if (StartDocPrinter(hPrinter, 1, di))
            {
                if (StartPagePrinter(hPrinter))
                {
                    Int32 dwWritten;
                    WritePrinter(hPrinter, pBytes, dwCount, out dwWritten);
                    EndPagePrinter(hPrinter);
                }
                EndDocPrinter(hPrinter);
            }
            ClosePrinter(hPrinter);
            Marshal.FreeCoTaskMem(pBytes);
            return true;
        }
        return false;
    }
}

class Program
{
    static void Main()
    {
        string html = "<html><body><h1>Hello World</h1></body></html>";
        // RawPrint cannot directly convert HTML to PDF
        // It sends raw data to printer, no PDF generation capability
        RawPrinterHelper.SendStringToPrinter("Microsoft Print to PDF", html);
    }
}
// NuGet: Install-Package System.Drawing.Common
using System;
using System.Drawing;
using System.Drawing.Printing;
using System.Runtime.InteropServices;
using System.Text;

class RawPrinterHelper
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public class DOCINFOA
    {
        [MarshalAs(UnmanagedType.LPStr)] public string pDocName;
        [MarshalAs(UnmanagedType.LPStr)] public string pOutputFile;
        [MarshalAs(UnmanagedType.LPStr)] public string pDataType;
    }

    [DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);

    [DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool ClosePrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool StartDocPrinter(IntPtr hPrinter, Int32 level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);

    [DllImport("winspool.Drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EndDocPrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool StartPagePrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool EndPagePrinter(IntPtr hPrinter);

    [DllImport("winspool.Drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
    public static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);

    public static bool SendStringToPrinter(string szPrinterName, string szString)
    {
        IntPtr pBytes;
        Int32 dwCount;
        dwCount = szString.Length;
        pBytes = Marshal.StringToCoTaskMemAnsi(szString);
        IntPtr hPrinter;
        if (OpenPrinter(szPrinterName, out hPrinter, IntPtr.Zero))
        {
            DOCINFOA di = new DOCINFOA();
            di.pDocName = "HTML Document";
            di.pDataType = "RAW";
            if (StartDocPrinter(hPrinter, 1, di))
            {
                if (StartPagePrinter(hPrinter))
                {
                    Int32 dwWritten;
                    WritePrinter(hPrinter, pBytes, dwCount, out dwWritten);
                    EndPagePrinter(hPrinter);
                }
                EndDocPrinter(hPrinter);
            }
            ClosePrinter(hPrinter);
            Marshal.FreeCoTaskMem(pBytes);
            return true;
        }
        return false;
    }
}

class Program
{
    static void Main()
    {
        string html = "<html><body><h1>Hello World</h1></body></html>";
        // RawPrint cannot directly convert HTML to PDF
        // It sends raw data to printer, no PDF generation capability
        RawPrinterHelper.SendStringToPrinter("Microsoft Print to PDF", html);
    }
}
Imports System
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Runtime.InteropServices
Imports System.Text

Class RawPrinterHelper
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)>
    Public Class DOCINFOA
        <MarshalAs(UnmanagedType.LPStr)> Public pDocName As String
        <MarshalAs(UnmanagedType.LPStr)> Public pOutputFile As String
        <MarshalAs(UnmanagedType.LPStr)> Public pDataType As String
    End Class

    <DllImport("winspool.Drv", EntryPoint:="OpenPrinterA", SetLastError:=True, CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function OpenPrinter(<MarshalAs(UnmanagedType.LPStr)> szPrinter As String, ByRef hPrinter As IntPtr, pd As IntPtr) As Boolean
    End Function

    <DllImport("winspool.Drv", EntryPoint:="ClosePrinter", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function ClosePrinter(hPrinter As IntPtr) As Boolean
    End Function

    <DllImport("winspool.Drv", EntryPoint:="StartDocPrinterA", SetLastError:=True, CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function StartDocPrinter(hPrinter As IntPtr, level As Integer, <[In], MarshalAs(UnmanagedType.LPStruct)> di As DOCINFOA) As Boolean
    End Function

    <DllImport("winspool.Drv", EntryPoint:="EndDocPrinter", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function EndDocPrinter(hPrinter As IntPtr) As Boolean
    End Function

    <DllImport("winspool.Drv", EntryPoint:="StartPagePrinter", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function StartPagePrinter(hPrinter As IntPtr) As Boolean
    End Function

    <DllImport("winspool.Drv", EntryPoint:="EndPagePrinter", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function EndPagePrinter(hPrinter As IntPtr) As Boolean
    End Function

    <DllImport("winspool.Drv", EntryPoint:="WritePrinter", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
    Public Shared Function WritePrinter(hPrinter As IntPtr, pBytes As IntPtr, dwCount As Integer, ByRef dwWritten As Integer) As Boolean
    End Function

    Public Shared Function SendStringToPrinter(szPrinterName As String, szString As String) As Boolean
        Dim pBytes As IntPtr
        Dim dwCount As Integer
        dwCount = szString.Length
        pBytes = Marshal.StringToCoTaskMemAnsi(szString)
        Dim hPrinter As IntPtr
        If OpenPrinter(szPrinterName, hPrinter, IntPtr.Zero) Then
            Dim di As New DOCINFOA()
            di.pDocName = "HTML Document"
            di.pDataType = "RAW"
            If StartDocPrinter(hPrinter, 1, di) Then
                If StartPagePrinter(hPrinter) Then
                    Dim dwWritten As Integer
                    WritePrinter(hPrinter, pBytes, dwCount, dwWritten)
                    EndPagePrinter(hPrinter)
                End If
                EndDocPrinter(hPrinter)
            End If
            ClosePrinter(hPrinter)
            Marshal.FreeCoTaskMem(pBytes)
            Return True
        End If
        Return False
    End Function
End Class

Class Program
    Shared Sub Main()
        Dim html As String = "<html><body><h1>Hello World</h1></body></html>"
        ' RawPrint cannot directly convert HTML to PDF
        ' It sends raw data to printer, no PDF generation capability
        RawPrinterHelper.SendStringToPrinter("Microsoft Print to PDF", html)
    End Sub
End Class
$vbLabelText   $csharpLabel

このコードは、RawPrint .NETの制限を示すものです:フォーマットされたドキュメントとしてレンダリングするのではなく、生のHTML文字列をプリンターに送信します。 出力は、レンダリングされたウェブページではなく、リテラルなHTMLマークアップテキストとなります。

IronPDFのHTML変換

IronPdfは完全なレンダリングで実際のHTMLからPDFへの変換を提供します:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = "<html><body><h1>Hello World</h1></body></html>";
        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");
        Console.WriteLine("PDF created successfully");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = "<html><body><h1>Hello World</h1></body></html>";
        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");
        Console.WriteLine("PDF created successfully");
    }
}
Imports IronPdf
Imports System

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim html As String = "<html><body><h1>Hello World</h1></body></html>"
        Dim pdf = renderer.RenderHtmlAsPdf(html)
        pdf.SaveAs("output.pdf")
        Console.WriteLine("PDF created successfully")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDFのアプローチでは、RenderHtmlAsPdf メソッドを使用してHTMLコンテンツを適切にレンダリングされたPDFドキュメントに変換します。 Chromiumエンジンは、CSS、JavaScript、HTMLを処理し、ブラウザのレンダリングと一致する出力を生成します。

URLからPDFへの変換

生きているウェブページをPDFに変換することで、能力の違いがさらによくわかります。

RawPrint .NETURL ハンドリングについて

RawPrint .NETはウェブページのレンダリングは出来ません:

// NuGet: Install-Package System.Drawing.Common
using System;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;

class Program
{
    static void Main()
    {
        // RawPrint cannot render web pages - only sends raw text/data
        // This would just print HTML source code, not rendered content
        using (WebClient client = new WebClient())
        {
            string htmlSource = client.DownloadString("https://example.com");
            // This prints raw HTML, not a rendered PDF
            RawPrinterHelper.SendStringToPrinter("Microsoft Print to PDF", htmlSource);
            Console.WriteLine("Raw HTML sent to printer (not rendered)");
        }
    }
}
// NuGet: Install-Package System.Drawing.Common
using System;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;

class Program
{
    static void Main()
    {
        // RawPrint cannot render web pages - only sends raw text/data
        // This would just print HTML source code, not rendered content
        using (WebClient client = new WebClient())
        {
            string htmlSource = client.DownloadString("https://example.com");
            // This prints raw HTML, not a rendered PDF
            RawPrinterHelper.SendStringToPrinter("Microsoft Print to PDF", htmlSource);
            Console.WriteLine("Raw HTML sent to printer (not rendered)");
        }
    }
}
Imports System
Imports System.Net
Imports System.Runtime.InteropServices
Imports System.Text

Module Program
    Sub Main()
        ' RawPrint cannot render web pages - only sends raw text/data
        ' This would just print HTML source code, not rendered content
        Using client As New WebClient()
            Dim htmlSource As String = client.DownloadString("https://example.com")
            ' This prints raw HTML, not a rendered PDF
            RawPrinterHelper.SendStringToPrinter("Microsoft Print to PDF", htmlSource)
            Console.WriteLine("Raw HTML sent to printer (not rendered)")
        End Using
    End Sub
End Module
$vbLabelText   $csharpLabel

このアプローチでは、HTMLソースコードをダウンロードし、生テキストとしてプリンタに送信します。 翻訳結果は、HTMLマークアップを印刷したもので、スタイル、画像、レイアウトを含むレンダリングされたウェブページではありません。

IronPDFのURL変換

IronPdfは生きたウェブサイトを直接PDFにレンダリングします:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        // Render a live website directly to PDF with full CSS, JavaScript, and images
        var pdf = renderer.RenderUrlAsPdf("https://example.com");
        pdf.SaveAs("webpage.pdf");
        Console.WriteLine("Website rendered to PDF successfully");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        // Render a live website directly to PDF with full CSS, JavaScript, and images
        var pdf = renderer.RenderUrlAsPdf("https://example.com");
        pdf.SaveAs("webpage.pdf");
        Console.WriteLine("Website rendered to PDF successfully");
    }
}
Imports IronPdf
Imports System

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        ' Render a live website directly to PDF with full CSS, JavaScript, and images
        Dim pdf = renderer.RenderUrlAsPdf("https://example.com")
        pdf.SaveAs("webpage.pdf")
        Console.WriteLine("Website rendered to PDF successfully")
    End Sub
End Class
$vbLabelText   $csharpLabel

RenderUrlAsPdf メソッドは、URLにナビゲートし、JavaScriptを実行し、CSSスタイリングを適用し、画像をロードし、完全にレンダリングされたページをPDFドキュメントとしてキャプチャします。

ドキュメント フォーマットの比較

フォーマット機能は、2つのアプローチのアーキテクチャの違いを明らかにします。

RawPrint .NETフォーマットについて

RawPrint .NETのフォーマットには、PCLまたはPostScriptの手動コマンドが必要です:

// NuGet: Install-Package System.Drawing.Common
using System;
using System.Drawing.Printing;
using System.Runtime.InteropServices;
using System.Text;

class Program
{
    static void Main()
    {
        // RawPrint requires manual PCL/PostScript commands for formatting
        string pclCommands = "\x1B&l0O\x1B(s0p16.66h8.5v0s0b3T";
        string text = "Plain text document - limited formatting";
        byte[] data = Encoding.ASCII.GetBytes(pclCommands + text);
        RawPrinterHelper.SendBytesToPrinter("HP LaserJet", data);
    }
}
// NuGet: Install-Package System.Drawing.Common
using System;
using System.Drawing.Printing;
using System.Runtime.InteropServices;
using System.Text;

class Program
{
    static void Main()
    {
        // RawPrint requires manual PCL/PostScript commands for formatting
        string pclCommands = "\x1B&l0O\x1B(s0p16.66h8.5v0s0b3T";
        string text = "Plain text document - limited formatting";
        byte[] data = Encoding.ASCII.GetBytes(pclCommands + text);
        RawPrinterHelper.SendBytesToPrinter("HP LaserJet", data);
    }
}
Imports System
Imports System.Drawing.Printing
Imports System.Runtime.InteropServices
Imports System.Text

Module Program
    Sub Main()
        ' RawPrint requires manual PCL/PostScript commands for formatting
        Dim pclCommands As String = ChrW(&H1B) & "&l0O" & ChrW(&H1B) & "(s0p16.66h8.5v0s0b3T"
        Dim text As String = "Plain text document - limited formatting"
        Dim data As Byte() = Encoding.ASCII.GetBytes(pclCommands & text)
        RawPrinterHelper.SendBytesToPrinter("HP LaserJet", data)
    End Sub
End Module
$vbLabelText   $csharpLabel

エスケープシーケンス(x1B&l0Oxx1B(s0p16.66h8.5v0s0b3T)は、プリンター設定のためのPCLコマンドを表します。 開発者は、プリンタ固有のコマンド言語を理解し、手作業でフォーマット命令を作成する必要があります。

IronPDFのフォーマット

IronPdfはリッチなフォーマットのために標準的なHTMLとCSSを使用しています:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = @"
            <html>
            <head>
                <style>
                    body { font-family: Arial; margin: 40px; }
                    h1 { color: #2c3e50; font-size: 24px; }
                    p { line-height: 1.6; color: #34495e; }
                    .highlight { background-color: yellow; font-weight: bold; }
                </style>
            </head>
            <body>
                <h1>Formatted Document</h1>
                <p>This is a <span class='highlight'>beautifully formatted</span> document with CSS styling.</p>
                <p>Complex layouts, fonts, colors, and images are fully supported.</p>
            </body>
            </html>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("formatted.pdf");
        Console.WriteLine("Formatted PDF created successfully");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = @"
            <html>
            <head>
                <style>
                    body { font-family: Arial; margin: 40px; }
                    h1 { color: #2c3e50; font-size: 24px; }
                    p { line-height: 1.6; color: #34495e; }
                    .highlight { background-color: yellow; font-weight: bold; }
                </style>
            </head>
            <body>
                <h1>Formatted Document</h1>
                <p>This is a <span class='highlight'>beautifully formatted</span> document with CSS styling.</p>
                <p>Complex layouts, fonts, colors, and images are fully supported.</p>
            </body>
            </html>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("formatted.pdf");
        Console.WriteLine("Formatted PDF created successfully");
    }
}
Imports IronPdf
Imports System

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim html As String = "
            <html>
            <head>
                <style>
                    body { font-family: Arial; margin: 40px; }
                    h1 { color: #2c3e50; font-size: 24px; }
                    p { line-height: 1.6; color: #34495e; }
                    .highlight { background-color: yellow; font-weight: bold; }
                </style>
            </head>
            <body>
                <h1>Formatted Document</h1>
                <p>This is a <span class='highlight'>beautifully formatted</span> document with CSS styling.</p>
                <p>Complex layouts, fonts, colors, and images are fully supported.</p>
            </body>
            </html>"

        Dim pdf = renderer.RenderHtmlAsPdf(html)
        pdf.SaveAs("formatted.pdf")
        Console.WriteLine("Formatted PDF created successfully")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDFは既存のウェブ開発スキルを活用します。 開発者は、プリンタ固有のコマンド言語ではなく、使い慣れたHTMLやCSSの構文を使用します。 このアプローチでは、標準的なウェブ技術により、複雑なレイアウト、フォント、色、画像をサポートします。

APIマッピングリファレンス

RawPrint .NETからIronPDFへの移行を検討しているチームは、この操作のマッピングを参照することができます:

RawPrint .NETIronPDF
Printer.SendBytesToPrinter()pdf.Print()</code
Printer.OpenPrinter()該当なし
Printer.ClosePrinter()該当なし
Printer.StartDocPrinter()該当なし
Printer.WritePrinter()該当なし
Printer.EndDocPrinter()該当なし
該当なしChromePdfRenderer</code
該当なしPdfDocument.Merge()を使用してください。
該当なしpdf.ApplyWatermark()</code

マッピングはIronPDFが手作業によるプリンターハンドル管理を完全に排除することを示しています。 RawPrint .NETで明示的なopen/close/start/endコールを必要とする操作は、IronPDFのハイレベルAPIによって自動的に処理されます。

機能比較マトリックス

フィーチャーRawPrint .NETIronPDF
PDFの作成
HTMLからPDFへなしはい
URLからPDFへなしはい
ゼロから作成なしはい
PDF操作
PDFのマージなしはい
PDFの分割なしはい
透かしの追加なしはい
既存の編集なしはい
印刷
印刷用PDFはい(生)はい(ハイレベル)
印刷ダイアログなしはい
複数部数制限的はい
DPIコントロールなしはい
デュプレックスなしはい
プラットフォーム
ウィンドウズはいはい
Linuxなしはい
macOSなしはい
ドッカーなしはい
その他
セキュリティなしはい
デジタル署名なしはい
PDF/Aなしはい

印刷比較

RawPrint .NETが提供する一つの機能、既存ドキュメントの印刷については、APIの複雑さが大きく異なります。

RawPrint .NET印刷

using RawPrint;
using System.IO;

byte[] pdfBytes = File.ReadAllBytes("document.pdf");
bool success = Printer.SendBytesToPrinter(
    "Brother HL-L2340D",
    pdfBytes,
    pdfBytes.Length
);

if (!success)
{
    throw new Exception("Print failed");
}
using RawPrint;
using System.IO;

byte[] pdfBytes = File.ReadAllBytes("document.pdf");
bool success = Printer.SendBytesToPrinter(
    "Brother HL-L2340D",
    pdfBytes,
    pdfBytes.Length
);

if (!success)
{
    throw new Exception("Print failed");
}
Imports RawPrint
Imports System.IO

Dim pdfBytes As Byte() = File.ReadAllBytes("document.pdf")
Dim success As Boolean = Printer.SendBytesToPrinter("Brother HL-L2340D", pdfBytes, pdfBytes.Length)

If Not success Then
    Throw New Exception("Print failed")
End If
$vbLabelText   $csharpLabel

RawPrint .NETでは、ファイルをバイトとして読み取り、成功/失敗の状態を手動で管理する必要があります。

IronPdfの印刷

using IronPdf;

var pdf = PdfDocument.FromFile("document.pdf");

// Simple print
pdf.Print();

// Or specify printer
pdf.Print("Brother HL-L2340D");
using IronPdf;

var pdf = PdfDocument.FromFile("document.pdf");

// Simple print
pdf.Print();

// Or specify printer
pdf.Print("Brother HL-L2340D");
Imports IronPdf

Dim pdf = PdfDocument.FromFile("document.pdf")

' Simple print
pdf.Print()

' Or specify printer
pdf.Print("Brother HL-L2340D")
$vbLabelText   $csharpLabel

IronPdfはプリンタ通信を自動的に処理するシンプルなPrintメソッドを提供します。 高度なシナリオのために、IronPDFはコピー、DPI、グレースケール設定を含む印刷オプションをサポートしています。

チームがRawPrint .NETへの移行を検討する時

開発チームがRawPrint .NETに代わるものを評価するのには、いくつかの要因があります:

PDF生成要件は、アプリケーションがPDFドキュメントを作成する必要があるときの障害となります。 RawPrint .NETはPDFを生成することは出来ません。 HTMLからPDFへの変換や文書作成が必要なチームは、RawPrint .NETと一緒に追加のライブラリを使用する必要があります。

クロスプラットフォーム展開の要件は、RawPrint .NETの能力を超えています。 ライブラリは、winspool.Drv DLLのインポートを通じて、Windowsの印刷サブシステムに完全に依存しています。 Linux、macOS、Dockerのデプロイメントには、それぞれ異なるソリューションが必要です。

APIの複雑さはメンテナンスの負担になります。 明示的なオープン/クローズ/スタート/エンドシーケンスによる手動プリンターハンドル管理は、高レベルのAPIと比較してコードの複雑さとエラーの可能性を増加させます。

限られた印刷コントロールは、生産要件に影響します。 RawPrint .NETは、コピー、DPI、両面印刷、印刷ダイアログのオプション無しで、基本的なバイト送信を提供します。

長所とトレードオフ

RawPrint .NETの長所

  • 特殊なハードウェア(ラベルプリンタ、ZPL/EPLデバイス)用のダイレクトプリンタアクセス
  • 生バイト送信のための最小限のオーバーヘッド
  • 基本的な印刷シナリオのためのシンプルなアーキテクチャ -ウィンドウズDLL以外の外部依存なし

RawPrint .NETの制限事項。

  • PDFの作成・生成機能はありません。
  • Windowsのみのプラットフォームサポート
  • プリンタハンドルの手動管理が必要
  • HTMLまたはURLレンダリングなし
  • 限られたフォーマット(PCL/PostScriptの知識が必要です)
  • PDF操作機能はありません

IronPDFの強み

  • HTML、URL、コードからの完全なPDF生成
  • クロスプラットフォーム対応(Windows、Linux、macOS、Docker)
  • 手動リソース管理を排除する高レベルAPI
  • ChromiumレンダリングによるCSSとJavaScriptのフルサポート
  • PDF操作(結合、分割、編集、透かし)
  • デジタル署名とセキュリティ機能
  • プロフェッショナルなサポートとドキュメント

IronPDFについての考察

  • 商用ライセンスモデル
  • Chromiumレンダリングエンジンのフットプリント
  • 生のプリンタアクセスではなく、PDFワークフロー向けに設計されています。

結論

RawPrint .NETとIronPDFは.NETドキュメント処理において基本的に異なる目的を果たします。 RawPrint .NETは、プリンタスプーラにrawバイトを送信するための低レベルアクセスを提供します-ラベルプリンタや直接コマンド送信を必要とするデバイスを使った特殊な印刷シナリオに便利です。 ただし、PDF文書の作成、レンダリング、操作はできません。

PDF生成、HTMLからPDFへの変換、ドキュメント操作、クロスプラットフォーム印刷を必要とするアプリケーションに対して、IronPDFはRawPrint .NETにはない包括的な機能を提供します。 高レベルのAPIは、マージ、分割、セキュリティ、デジタル署名の機能を追加しながら、手作業によるプリンタハンドルの管理を排除します。

RawPrint .NETからIronPDFへの移行を評価する際、チームはそれぞれの要件を考慮する必要があります。 主なニーズがPDFドキュメントの作成と操作で、印刷が副次的な機能である場合、IronPDFは完全なワークフローに対応します。 2026年に.NET 10とC# 14をターゲットとし、クロスプラットフォーム展開が要求されるチームにとって、IronPDFのアーキテクチャはWindowsに特化したRawPrint .NETのアプローチよりも適切な基盤を提供します。


実装ガイダンスについては、IronPDFドキュメント印刷チュートリアルで、.NETアプリケーションのためのPDF生成と印刷パターンをカバーしています