IRONSOFTWAREHOME
세로 및 가로 방향
from ironpdf import *
 
# For NEW PDF Documents use PdfPaperOrientation
# PdfPaperOrientation: To choose Landscape or Portrait Orientation in a new PDF document
renderer = ChromePdfRenderer()
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape

new_pdf_from_html = renderer.RenderHtmlAsPdf("<h1> Hello World! </h1>")
new_pdf_from_html_file = renderer.RenderHtmlFileAsPdf("example.html")
new_pdf_from_url = renderer.RenderUrlAsPdf("https://ironpdf.com")

# For EXISTING PDFs use PageRotation
# PageRotation: To rotate a PDF page and all of its contents
existing_pdf = PdfDocument.FromFile("old_report.pdf")

# Get rotation value
get_rotation_first_page = existing_pdf.Pages[0].PageRotation

# Rotate specified page
existing_pdf.SetPageRotation(PageIndex=0, Rotation=PdfPageRotation.Clockwise90)

# Rotate ALL pages
existing_pdf.SetAllPageRotations(PdfPageRotation.Clockwise270)
pip install ironpdf
세로 및 가로 방향

세로 및 가로 방향

IronPDF for Python은 새로운 PDF에 대해 가로 방향 및 세로 방향 페이지 설정을 지원하며, 기존 문서에 대해 페이지별 회전 제어를 제공합니다.

시작하기

새 PDF의 경우, 렌더 메서드를 호출하기 전에 RenderingOptions.PaperOrientation을 설정합니다. 기존 PDF의 경우, 로드된 PdfDocument에서 개별 페이지나 전체 문서를 회전시키기 위해 SetPageRotation 또는 SetAllPageRotations을 사용하세요.

코드 이해하기

새로운 PDF

  • PaperOrientation = PdfPaperOrientation.Landscape: PDF를 가로 방향에서 렌더링합니다. 기본 수직 레이아웃으로 돌아가려면 Portrait을 사용하세요.
  • RenderHtmlAsPdf, RenderHtmlFileAsPdf, 및 RenderUrlAsPdf과 함께 작동합니다.

기존 PDF

  • PdfDocument.FromFile(path): 기존 PDF 파일을 로드합니다.
  • Pages[0].PageRotation: 첫 페이지의 현재 회전을 읽습니다 (기수 인덱스).
  • SetPageRotation(PageIndex, Rotation): 특정 각도로 단일 페이지를 회전시킵니다.
  • SetAllPageRotations(Rotation): 문서의 모든 페이지에 동일한 회전을 적용합니다.

회전 값

PdfPageRotation 열거형은 네 가지 옵션을 제공합니다:

None
Clockwise9090°
Clockwise180180°
Clockwise270270°
IronPDF for Python을 사용하여 PDF 레이아웃을 맞춤 설정하는 방법을 배우세요!

시작할 준비 되셨나요?

버전:2026.6방금 출시

Key in blue circle

무료 30일 체험 키를 즉시 받으세요.

Your trial license will be sent to your email address

제한 없음. 100% 무제한 이용. 신용카드 불필요.

bullet_checked신용카드나 계정 생성은 필요하지 않습니다.제한 없음. 100% 무제한 이용. 신용카드 불필요.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
무료 라이브 데모를 예약하세요
Booking Badge

전 세계 수백만 엔지니어들이 신뢰하는 제품입니다.

Iron Software의 고객 로고
부담 없는 무료 상담을 받아보세요
아래 양식을 작성하시거나 sales@ironsoftware.com으로 이메일을 보내주세요.
고객님의 정보는 항상 비밀로 유지됩니다.
전 세계 수백만 엔지니어들이 신뢰하는 제품입니다.
Iron Software의 고객 로고
지금 바로 30일 무료 체험판 키를 받으세요.
신용카드나 계정 생성은 필요하지 않습니다.