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

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

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

IronPrint는 PaperOrientation 클래스에서 PrintSettings 속성을 제공합니다. 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

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

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

  • 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 방식에서는 방향성이 DefaultPageSettings.Landscape = true 내부에 포함된 부울(boolean) 값이며, 이는 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의 PRINT 메서드에 전달하십시오. 완벽한 레이아웃 제어를 위해 PaperSize, DpiPaperMargins와 함께 사용하십시오.

사용 가능한 모든 속성을 탐색하려면 인쇄 설정 하우투를, 모든 메서드 표면을 포함하는 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 속성을 활용하여 세로, 가로 또는 자동 모드를 지정함으로써 용지 방향을 완전히 제어할 수 있습니다.

A PHP Error was encountered

Severity: Warning

Message: Illegal string offset 'name'

Filename: sections/author_component.php

Line Number: 18

Backtrace:

File: /var/www/ironpdf.com/application/views/main/sections/author_component.php
Line: 18
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 63
Function: view

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 64
Function: main_view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/how-to/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Howto.php
Line: 31
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Illegal string offset 'title'

Filename: sections/author_component.php

Line Number: 38

Backtrace:

File: /var/www/ironpdf.com/application/views/main/sections/author_component.php
Line: 38
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 63
Function: view

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 64
Function: main_view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/how-to/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Howto.php
Line: 31
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Illegal string offset 'comment'

Filename: sections/author_component.php

Line Number: 48

Backtrace:

File: /var/www/ironpdf.com/application/views/main/sections/author_component.php
Line: 48
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 63
Function: view

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 64
Function: main_view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/how-to/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Howto.php
Line: 31
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

시작할 준비 되셨나요?
Nuget 다운로드 41,154 | 버전: 2026.5 just released
Still Scrolling Icon

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

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