C#에서 PDF 문서를 인쇄하는 방법

C# Print Document Tutorial with IronPrint

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

IronPrint .NET C# 개발자가 애플리케이션에 인쇄 기능을 통합하는 데 도움을 주기 위해 설계된 강력한 인쇄 라이브러리입니다. IronPrint Windows, macOS, iOS 및 Android 플랫폼을 아우르는 폭넓은 호환성을 갖추고 있어 다양한 운영 체제에서 일관되고 안정적으로 작동합니다. 데스크톱 환경, Apple의 macOS 생태계 또는 iOS 및 Android와 같은 모바일 플랫폼용 애플리케이션을 개발하든 IronPrint 인쇄 기능 구현을 간소화하여 .NET C# 환경에서 모든 인쇄 요구 사항에 맞는 다재다능하고 사용자 친화적인 솔루션을 제공합니다.

빠른 시작: IronPrint 로 문서를 조용히 인쇄하기

단 한 줄의 코드로 바로 출력할 수 있습니다. 대화 상자도 없고, 복잡한 과정도 필요 없습니다. IronPrint.Printer.Print(...)를 사용하여 기본 또는 사용자 지정 설정을 사용하여 PDF나 이미지를 프린터로 바로 조용히 보낼 수 있습니다.

  1. NuGet 패키지 관리자를 사용하여 https://www.nuget.org/packages/IronPrint 설치하기

    PM > Install-Package IronPrint
  2. 다음 코드 조각을 복사하여 실행하세요.

    IronPrint.Printer.Print("path/to/your/document.pdf");
  3. 실제 운영 환경에서 테스트할 수 있도록 배포하세요.

    무료 체험판으로 오늘 프로젝트에서 IronPrint 사용 시작하기

    arrow pointer

목차

문서 인쇄

소리 없이 인쇄하기

인쇄 대화 상자를 표시하지 않고도 문서를 원활하게 인쇄할 수 있습니다. 인쇄 설정은 코드 내에서 직접 수행할 수 있습니다.

// Programmatically print a document without showing the print dialog.
// Define your print job and settings here as needed.

using System;
using IronPrint;

public class SilentPrint
{
    public static void Main()
    {
        // Create a print document instance
        var document = new PrintDocument("sample-document.pdf");

        // Initialize a silent print job
        var printJob = new PrintJob(document);

        // Apply specific settings as necessary
        // For example: set printer name, copies, etc.

        // Execute the print job
        printJob.PrintSilently();
    }
}
// Programmatically print a document without showing the print dialog.
// Define your print job and settings here as needed.

using System;
using IronPrint;

public class SilentPrint
{
    public static void Main()
    {
        // Create a print document instance
        var document = new PrintDocument("sample-document.pdf");

        // Initialize a silent print job
        var printJob = new PrintJob(document);

        // Apply specific settings as necessary
        // For example: set printer name, copies, etc.

        // Execute the print job
        printJob.PrintSilently();
    }
}
$vbLabelText   $csharpLabel

대화 상자를 사용하여 인쇄

인쇄 설정 대화 상자가 나타나면 인쇄 프로세스를 시작하십시오. 이를 통해 사용자는 인쇄 옵션을 대화형으로 맞춤 설정할 수 있습니다.

// Start a print job with user interaction through the print dialog.

using System;
using IronPrint;

public class DialogPrint
{
    public static void Main()
    {
        // Create a print document instance
        var document = new PrintDocument("sample-document.pdf");

        // Initialize a print job with dialog
        var printJob = new PrintJob(document);

        // Execute the print job with display of print options dialog
        printJob.PrintWithDialog();
    }
}
// Start a print job with user interaction through the print dialog.

using System;
using IronPrint;

public class DialogPrint
{
    public static void Main()
    {
        // Create a print document instance
        var document = new PrintDocument("sample-document.pdf");

        // Initialize a print job with dialog
        var printJob = new PrintJob(document);

        // Execute the print job with display of print options dialog
        printJob.PrintWithDialog();
    }
}
$vbLabelText   $csharpLabel

인쇄 설정 적용

특정 요구 사항을 충족하도록 인쇄 설정을 프로그램 방식으로 조정합니다. 이 섹션에서는 코드를 통해 인쇄 설정을 세밀하게 조정할 수 있는 기능을 제공합니다.

// Example code to apply custom print settings programmatically.

using System;
using IronPrint;

public class PrintSettingsExample
{
    public static void Main()
    {
        // Create a print document instance
        var document = new PrintDocument("sample-document.pdf");

        // Create a print job
        var printJob = new PrintJob(document);

        // Set custom print settings like duplex, color mode, etc.
        var settings = new PrintSettings
        {
            ColorMode = ColorMode.Color,
            DuplexMode = DuplexMode.OneSided,
            Copies = 2
        };

        // Apply settings to print job
        printJob.ApplySettings(settings);

        // Print the document
        printJob.PrintSilently();
    }
}
// Example code to apply custom print settings programmatically.

using System;
using IronPrint;

public class PrintSettingsExample
{
    public static void Main()
    {
        // Create a print document instance
        var document = new PrintDocument("sample-document.pdf");

        // Create a print job
        var printJob = new PrintJob(document);

        // Set custom print settings like duplex, color mode, etc.
        var settings = new PrintSettings
        {
            ColorMode = ColorMode.Color,
            DuplexMode = DuplexMode.OneSided,
            Copies = 2
        };

        // Apply settings to print job
        printJob.ApplySettings(settings);

        // Print the document
        printJob.PrintSilently();
    }
}
$vbLabelText   $csharpLabel

프린터 정보 가져오기

프린터 이름 가져오기

사용 가능한 모든 프린터 목록을 확인하세요. 시스템에 설치된 프린터 이름을 검색하여 정보 제공 또는 애플리케이션에서 동적으로 프린터를 선택하는 데 사용할 수 있습니다.

// Retrieve and display a list of printer names available on the system.

using System;
using IronPrint;

public class PrinterInfo
{
    public static void Main()
    {
        // Get an enumerable list of printer names
        var printerNames = PrinterSettings.GetAvailablePrinters();

        // Print each printer name to the console
        Console.WriteLine("Available Printers:");
        foreach (var name in printerNames)
        {
            Console.WriteLine(name);
        }
    }
}
// Retrieve and display a list of printer names available on the system.

using System;
using IronPrint;

public class PrinterInfo
{
    public static void Main()
    {
        // Get an enumerable list of printer names
        var printerNames = PrinterSettings.GetAvailablePrinters();

        // Print each printer name to the console
        Console.WriteLine("Available Printers:");
        foreach (var name in printerNames)
        {
            Console.WriteLine(name);
        }
    }
}
$vbLabelText   $csharpLabel

자주 묻는 질문

.NET C#에서 문서를 소리 없이 인쇄하려면 어떻게 해야 하나요?

PrintJob 인스턴스의 PrintSilently() 메서드를 사용하면 사용자 상호 작용 없이 인쇄 작업을 실행할 수 있습니다. 이를 통해 인쇄 대화 상자를 표시하지 않고도 문서를 프로그램 방식으로 인쇄할 수 있습니다.

.NET C#에서 인쇄 대화 상자를 사용하여 문서를 인쇄하는 과정은 무엇입니까?

PrintJob 인스턴스의 PrintWithDialog() 메서드를 사용하면 사용자 상호 작용을 통해 인쇄 작업을 시작할 수 있습니다. 이 메서드는 인쇄 설정 대화 상자를 표시하여 사용자가 인쇄하기 전에 옵션을 사용자 지정할 수 있도록 합니다.

.NET C#에서 프로그래밍 방식으로 사용자 지정 인쇄 설정을 적용하는 것이 가능할까요?

예, PrintSettings 객체를 생성하고 색상 모드, 양면 인쇄 모드, 복사 매수 등의 속성을 구성하여 사용자 지정 인쇄 설정을 프로그래밍 방식으로 적용할 수 있습니다. 이렇게 설정한 값은 PrintJob 인스턴스에 적용할 수 있습니다.

.NET C# 애플리케이션에서 사용 가능한 프린터 이름을 어떻게 가져올 수 있나요?

PrinterSettings.GetAvailablePrinters() 메서드를 사용하면 사용 가능한 프린터 이름을 가져올 수 있습니다. 이 메서드는 시스템에 설치된 프린터 목록을 제공하여 선택 또는 정보 제공 목적으로 활용할 수 있도록 합니다.

.NET C# 라이브러리를 사용하여 다양한 문서 형식을 인쇄할 수 있습니까?

네, 해당 라이브러리는 PDF, PNG, HTML, TIFF, GIF, JPEG, IMAGE, BITMAP 등 다양한 문서 형식을 지원하여 다채로운 문서 인쇄 옵션을 제공합니다.

.NET C# 라이브러리를 사용하여 문서를 인쇄할 때 지원되는 플랫폼은 무엇입니까?

이 라이브러리는 Windows, macOS, iOS 및 Android와 같은 다양한 플랫폼을 지원하여 이러한 운영 체제 전반에서 일관되고 안정적인 인쇄 기능을 보장합니다.

.NET C#에서 무음 인쇄는 대화 상자 기반 인쇄와 어떻게 다른가요?

무음 인쇄는 PrintSilently() 메서드를 사용하여 사용자 상호 작용 없이 프로그램을 통해 문서를 인쇄할 수 있도록 합니다. 대화 상자 기반 인쇄는 PrintWithDialog() 메서드를 통해 사용자가 인쇄 설정을 지정할 수 있도록 인쇄 대화 상자를 표시하는 방식입니다.

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.

시작할 준비 되셨나요?
Nuget 다운로드 38,093 | 버전: 2026.3 방금 출시되었습니다
Still Scrolling Icon

아직도 스크롤하고 계신가요?

빠른 증거를 원하시나요? PM > Install-Package IronPrint
샘플을 실행하세요 문서가 프린터로 전송되는 것을 지켜보세요.