IRONSOFTWAREHOME
縦向き & 横向き

import com.ironsoftware.ironpdf.PdfDocument;  
import com.ironsoftware.ironpdf.edit.PageSelection;  
import com.ironsoftware.ironpdf.page.PageRotation;  
import com.ironsoftware.ironpdf.render.*;  
import java.io.IOException;  
import java.nio.file.Paths;

// Use the setPaperOrientation method to set rendered PDFs in portrait or landscape orientation.  
// Note: This will only work for newly-created PDFs!  
ChromePdfRenderOptions renderOptions = new ChromePdfRenderOptions();  
renderOptions.setPaperOrientation(PaperOrientation.LANDSCAPE);  
PdfDocument newPdf = PdfDocument.renderUrlAsPdf("https://ironpdf.com", renderOptions);  
newPdf.saveAs(Paths.get("assets/LandscapePdf.pdf"));  
  
// Use the rotatePage/rotateAllPages methods to adjust the page orientation for existing PDFs  
PdfDocument existingPdf = PdfDocument.fromFile(Paths.get("assets/example.pdf"));  
  
// Get the orientation of the first page of the existing PDF document.  
PageRotation firstPageRotation = existingPdf.getPagesInfo().get(0).getPageRotation();  
System.out.println(firstPageRotation);  
  
// Rotate the first page of the document only 90 degrees clockwise.  
existingPdf.rotatePage(PageRotation.CLOCKWISE_90, PageSelection.firstPage());  
  
// Rotate all pages of the document clockwise.  
existingPdf.rotateAllPages(PageRotation.CLOCKWISE_270);  
  
existingPdf.saveAs(Paths.get("assets/ExistingPdfRotated.pdf"));
mvn install
縦向き & 横向き

縦向き & 横向き

IronPDF for Javaは、新しいPDFドキュメントや既存のドキュメントのページの向きを変更できます。

IronPDFで新しくレンダリングされたPDFドキュメントは、デフォルトで縦向きを使用します。 開発者は、ChromePdfRenderOptions インスタンスを使用して、コンテンツ (HTML、RTF、URL など) をPDFに変換する際のこの動作をオーバーライドすることができます。 setPaperOrientation メソッドは PaperOrientation 値を受け入れ、開発者が結果のPDFの用紙の向きを希望するように変更することを許可します。 注目のコード例の21行目から23行目は、横向きのPDFドキュメントを作成します。 21行目のPaperOrientation.LANDSCAPEの呼び出しは、向きの動作をトリガーします。 列挙型の値をPdfDocument.renderUrlAsPdfの呼び出しでIronPDFホームページを縦向きで作成できます。

既存のPDFのページの向きを変更するためにPdfDocument.fromFileメソッドを使用してIronPDFにロードされたものです)。 これらのPDFドキュメントについては、回転ベースの変換でページの向きを調整できます。 この目的のために、IronPDFはrotateAllPagesメソッドを利用可能にしています。

rotateAllPages は、許可された回転値のセットを指定する PageRotation 列挙型を受け入れます。 注目のコード例の40行目では、作業中のPDFドキュメントの各ページを270度時計回りに回転します。 PDFの中で1ページだけ(またはページの一部を)、回転させるには、rotatePageメソッドを選択してください。

Learn more about PaperOrientation in IronPDF for Java.
GitHubで見る

準備はできましたか?

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

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のため for Java Mavenライブラリ
Mavenでインストール

バージョン: 2026.6

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>2026.6.1</version>
</dependency>
https://central.sonatype.com/artifact/com.ironsoftware/ironpdf/2026.6.1
or
Java PDF JAR
JAR をダウンロード

バージョン: 2026.6

Manually install into your project