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で個々のページまたはドキュメント全体を回転させます。

コードの理解

新しいPDFファイル

  • PaperOrientation = PdfPaperOrientation.Landscape: PDFを横向きでレンダリングします。 デフォルトの縦向きレイアウトに戻るにはPortraitを使用します。
  • RenderUrlAsPdfで動作します。

既存のPDFファイル

  • PdfDocument.FromFile(path): 既存のPDFファイルをロードします。
  • Pages[0].PageRotation: 最初のページの現在の回転を読み取ります(ゼロベースインデックス)。
  • SetPageRotation(PageIndex, Rotation): 指定された角度に単一のページを回転させます。
  • SetAllPageRotations(Rotation): ドキュメント内のすべてのページに同じ回転を適用します。

回転値

PdfPageRotation列挙型は4つのオプションを提供します。

価値度
None0°
Clockwise9090°
Clockwise180180°
Clockwise270270°
IronPDF for PythonでPDFレイアウトをカスタマイズする方法を学びましょう!

準備はできましたか?

バージョン:2026.9リリースされたばかり

Key in blue circle

無料の30日間トライアルキーをすぐに入手してください。

Your trial license will be sent to your email address

制限なし。100% ロック解除済み。クレジットカード不要。

OR
bullet_checkedクレジットカードやアカウントの作成は不要です。制限なし。100% ロック解除済み。クレジットカード不要。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
無料のライブデモを予約する
Booking Badge

世界中の数百万人のエンジニアから信頼されています。

ライセンスはより安く
義務のない相談を受ける
下記のフォームを記入するか、sales@ironsoftware.comにメールしてください。
あなたの詳細は常に守秘されます。
世界中の数百万人のエンジニアから信頼されています。
ライセンスはより安く
あなたの無料30日間の試用キーをすぐに入手。
クレジットカードやアカウントの作成は不要です。
PDF用Pythonモジュールダウンロード
pipでインストール

バージョン: 2026.9

  1. ダウンロードしてPython 3.7+をインストールしてください。
  2. pipをインストールするにはpypi.orgからダウンロードしてください。
  3. 上記のコマンドをターミナルで実行します。
Python PDFモジュール
モジュールをダウンロード

バージョン: 2026.9

Manually install into your project

  1. パッケージをダウンロード
  2. ターミナルからこのコマンドを実行してください
    pip install ironpdf-2026.9-py37-none-win_amd64.whl

ライセンスは$999から