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 문서와 기존 PDF 문서의 페이지 방향을 수정할 수 있습니다.

IronPDF 로 새로 렌더링된 PDF 문서는 기본적으로 세로 방향으로 표시됩니다. 개발자는 ChromePdfRenderOptions 인스턴스를 사용하여 컨텐츠(HTML, RTF, URL 등)를 PDF로 변환할 때 이 동작을 재정의할 수 있습니다. setPaperOrientation 메서드는 PaperOrientation 값을 수락하며, 원하는 대로 결과 PDF의 용지 방향을 변경할 수 있습니다. 본문에 제시된 코드 예제의 21~23번째 줄은 가로 방향으로 설정된 PDF 문서를 생성합니다. 21행에서 PaperOrientation.LANDSCAPE와 함께 setPaperOrientation를 호출하면 방향 동작이 트리거됩니다. 열거형 값을 PaperOrientation.PORTRAIT의 옹호에 사용하면 이후 PdfDocument.renderUrlAsPdf 호출 시 IronPDF 홈페이지는 세로 방향으로 생성됩니다.

ChromePdfRenderOptions 객체는 기존 PDF의 페이지 방향을 변경하는 데 사용할 수 없습니다(이들은 PDF 렌더링 메서드의 이전 호출에서 생성된 것이거나 PdfDocument.fromFile 메서드를 사용하여 IronPDF에 로드된 것이어야 합니다). 이러한 PDF 문서의 경우 회전 기반 변환을 통해 페이지 방향을 조정할 수 있습니다. 이를 위해 IronPDF는 rotateAllPages 메서드를 사용할 수 있도록 합니다.

rotateAllPages는 허용되는 회전 값을 지정하는 PageRotation 열거형을 수락합니다. 예시 코드의 40번째 줄은 작업 중인 PDF 문서의 모든 페이지를 시계 방향으로 270도 회전시킵니다. PDF의 한 페이지만(또는 일부 페이지) 회전시키려면 rotateAllPages 대신 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% 무제한 이용. 신용카드 불필요.

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일 무료 체험판 키를 받으세요.
신용카드나 계정 생성은 필요하지 않습니다.