C#에서 인쇄를 위한 종이 방향 설정 방법

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

종이 방향은 문서를 세로(길이방향) 또는 가로(넓이방향) 모드로 인쇄할지를 제어합니다. 세로는 대부분의 편지, 청구서, 보고서에 적합합니다. 가로는 넓은 테이블, 스프레드시트, 대시보드, 프레젠테이션 슬라이드에 더 좋습니다. 프로그램적으로 방향을 설정하여 사용자의 기본 프린터 구성에 관계없이 일관된 출력을 보장합니다.

IronPrintPrintSettings 클래스에 PaperOrientation 속성을 노출합니다. 우리는 이를 Portrait 또는 Landscape로 설정하고, 설정을 Printer.Print()에 전달하며, 문서는 지정된 레이아웃으로 인쇄됩니다.

빠른 시작: 종이 방향 설정

  1. NuGet을 통해 IronPrint 설치: Install-Package IronPrint
  2. 파일에 using IronPrint; 추가
  3. PrintSettings 객체 생성
  4. PaperOrientationPortrait 또는 Landscape로 설정
  5. 설정을 Printer.Print() 또는 Printer.ShowPrintDialog()에 전달
  1. NuGet 패키지 관리자를 사용하여 https://www.nuget.org/packages/IronPrint 설치하기

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

    using IronPrint;
    
    // Print a document in landscape orientation
    Printer.Print("report.pdf", new PrintSettings
    {
        PaperOrientation = PaperOrientation.Landscape
    });
  3. 실제 운영 환경에서 테스트할 수 있도록 배포하세요.

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

    arrow pointer

인쇄를 위해 종이 방향을 어떻게 설정합니까?

PrintSettings에 있는 PaperOrientation 속성은 세 가지 값을 허용합니다:

  • PaperOrientation.Portrait — 수직 레이아웃 (대부분의 프린터에서 기본값). 편지, 계약서, 청구서 같은 단일 열 문서에 가장 적합합니다.
  • PaperOrientation.Landscape — 수평 레이아웃. 데이터 테이블, 간트 차트, 스프레드시트, 슬라이드 데크 같은 넓은 내용에 가장 적합합니다.
  • PaperOrientation.Automatic — 프린터의 기본 설정에 따릅니다.

우리는 PrintSettings 객체를 생성하고 원하는 방향을 할당한 후 이를 비동기 인쇄를 위해 Printer.Print()에 또는 대화 기반 인쇄를 위해 Printer.ShowPrintDialog()에 전달합니다.

:path=/static-assets/print/content-code-examples/how-to/set-paper-orientation/set-paper-orientation-portrait-and-landscape-orientation.cs
using IronPrint;

// Configure portrait orientation
var portraitSettings = new PrintSettings
{
    PaperOrientation = PaperOrientation.Portrait
};

// Print the invoice in portrait
Printer.Print("invoice.pdf", portraitSettings);

// Configure landscape orientation
var landscapeSettings = new PrintSettings
{
    PaperOrientation = PaperOrientation.Landscape
};

// Print the dashboard in landscape
Printer.Print("quarterly-dashboard.pdf", landscapeSettings);
Imports IronPrint

' Configure portrait orientation
Dim portraitSettings As New PrintSettings With {
    .PaperOrientation = PaperOrientation.Portrait
}

' Print the invoice in portrait
Printer.Print("invoice.pdf", portraitSettings)

' Configure landscape orientation
Dim landscapeSettings As New PrintSettings With {
    .PaperOrientation = PaperOrientation.Landscape
}

' Print the dashboard in landscape
Printer.Print("quarterly-dashboard.pdf", landscapeSettings)
$vbLabelText   $csharpLabel

네이티브 .NET System.Drawing.Printing 접근 방식을 사용하면 방향은 boolean (DefaultPageSettings.Landscape = true)으로 PrintDocument 내부에 묻혀 있으며, 그래픽 렌더링과 수동 페이지 관리를 필요로 하는 PrintPage 이벤트 처리가 필요합니다. IronPrint는 설정 객체의 단일 속성으로 전체 파이프라인을 대체합니다.

다른 인쇄 설정과 방향을 어떻게 결합합니까?

방향은 전체 인쇄 레이아웃을 정의하기 위해 종이 크기, DPI 및 여백과 결합될 때 가장 유용합니다. PrintSettings 클래스는 하나의 객체에서 이 모든 것을 구성할 수 있게 합니다.

:path=/static-assets/print/content-code-examples/how-to/set-paper-orientation/set-paper-orientation-combine-orientation-with-settings.cs
using IronPrint;

// Combine orientation with paper size, DPI, and margins
var settings = new PrintSettings
{
    PaperOrientation = PaperOrientation.Landscape,
    PaperSize = PaperSize.A4,
    Dpi = 300,
    NumberOfCopies = 1,
    PaperMargins = new Margins(15, 15, 15, 15),
    Grayscale = false
};

// Print the financial report
Printer.Print("financial-report.pdf", settings);
Imports IronPrint

' Combine orientation with paper size, DPI, and margins
Dim settings As New PrintSettings With {
    .PaperOrientation = PaperOrientation.Landscape,
    .PaperSize = PaperSize.A4,
    .Dpi = 300,
    .NumberOfCopies = 1,
    .PaperMargins = New Margins(15, 15, 15, 15),
    .Grayscale = False
}

' Print the financial report
Printer.Print("financial-report.pdf", settings)
$vbLabelText   $csharpLabel

PaperSizePaperOrientation는 함께 작동합니다 — A4 가로 방향을 설정하면 297 × 210 mm의 인쇄 영역, A4 세로 방향을 설정하면 210 × 297 mm의 인쇄 영역을 제공합니다. Dpi 속성은 출력 해상도를 제어합니다 (비즈니스 문서에 대한 표준은 300) 및 PaperMargins 값은 밀리미터 단위입니다.

인쇄 대화 상자에서 사용자에게 방향 선택을 허용하는 방법은 무엇인가요?

PrintSettingsPrinter.ShowPrintDialog()에 전달하면 대화 상자가 미리 설정된 방향으로 열립니다. 사용자는 이를 수락하거나 인쇄 전에 세로 방향과 가로 방향을 전환할 수 있습니다.

:path=/static-assets/print/content-code-examples/how-to/set-paper-orientation/set-paper-orientation-dialog-with-orientation-preset.cs
using IronPrint;

// Pre-configure landscape orientation for the dialog
var settings = new PrintSettings
{
    PaperOrientation = PaperOrientation.Landscape,
    PaperSize = PaperSize.Letter
};

// Open the dialog with pre-selected orientation
Printer.ShowPrintDialog("wide-report.pdf", settings);
Imports IronPrint

' Pre-configure landscape orientation for the dialog
Dim settings As New PrintSettings With {
    .PaperOrientation = PaperOrientation.Landscape,
    .PaperSize = PaperSize.Letter
}

' Open the dialog with pre-selected orientation
Printer.ShowPrintDialog("wide-report.pdf", settings)
$vbLabelText   $csharpLabel

비동기 UI 시나리오의 경우, 비동기 변형 Printer.ShowPrintDialogAsync()은 동일한 매개변수를 받아들이며 대화 상자가 열려있는 동안 애플리케이션을 응답하게 유지합니다. 이는 특히 방향 설정에 유용한데, 사용자가 인쇄 작업에 착수하기 전에 세로 방향과 가로 방향에서 문서가 어떻게 보이는지 미리 보기 원하기 때문입니다. 인쇄 문서 튜토리얼은 무음과 대화형 워크플로우를 처음부터 끝까지 다룹니다.

다음 단계

용지 방향은 PrintSettings 객체의 한 가지 속성입니다 — PaperOrientationPortrait, Landscape, Automatic로 설정하고 이를 IronPrint의 모든 인쇄 메서드에 전달합니다. PaperSize, Dpi, 그리고 PaperMargins과 결합하여 전체 레이아웃 제어를 제공합니다. using 가능한 모든 속성을 탐색하려면 인쇄 설정 하우투를, 모든 메서드 표면을 포함하는 Printer 클래스 API 참조를, 또는 실행 가능한 코드 조각 페이지를 보려면 코드 예제 페이지를 참조하십시오. IronPrint 튜토리얼은 전체 인쇄 라이프사이클을 설명하며, 변경 로그는 성능 향상을 포함한 최근 업데이트를 추적합니다.

무료 30일 체험판을 시작하여 실제 프로젝트에서 방향 설정을 테스트하십시오. 준비가 되면, 라이센스 옵션 보기 시작점 $999.

자주 묻는 질문

C#에서 인쇄를 위한 용지 방향을 설정하려면 어떻게 해야 합니까?

C#에서 인쇄를 위한 용지 방향을 설정하려면, IronPrint의 PaperOrientation 속성을 사용하면 됩니다. 이를 통해 세로, 가로 또는 자동 방향으로 문서를 인쇄할지 지정할 수 있습니다.

IronPrint에서 사용할 수 있는 용지 방향 옵션은 무엇입니까?

IronPrint는 용지 방향을 세로, 가로 또는 자동으로 설정할 수 있는 옵션을 제공하여 문서가 어떻게 인쇄될지에 대해 완전한 제어를 할 수 있습니다.

IronPrint에서 자동으로 용지 방향을 결정할 수 있습니까?

네, IronPrint는 문서에 가장 적합한 용지 방향을 자동으로 결정할 수 있는 자동 용지 방향 설정을 제공합니다.

IronPrint에서 용지 방향을 제어하기 위해 사용하는 속성은 무엇입니까?

IronPrint의 PaperOrientation 속성은 C#에서 문서 인쇄를 위한 용지 방향을 제어하는 데 사용됩니다.

IronPrint는 가로 인쇄를 처리할 수 있습니까?

네, IronPrint는 PaperOrientation 속성을 가로로 설정하여 가로 인쇄를 처리할 수 있습니다.

IronPrint는 문서 인쇄를 위한 세로 모드를 지원합니까?

IronPrint는 PaperOrientation 속성을 세로로 설정하여 문서 인쇄를 위한 세로 모드를 완전히 지원합니다.

IronPrint를 사용하여 C#에서 용지 방향을 완전히 제어하려면 어떻게 해야 합니까?

IronPrint의 PaperOrientation 속성을 활용하여 세로, 가로 또는 자동 모드를 지정함으로써 용지 방향을 완전히 제어할 수 있습니다.

Curtis Chau
기술 문서 작성자

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

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

시작할 준비 되셨나요?
Nuget 다운로드 44,051 | 버전: 2026.7 방금 출시
Still Scrolling Icon

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

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