PDFium Delphi Component Docs

FlattenPageRotation 메서드

컴포넌트: TPdf  ·  유닛: PDFium
모든 페이지의 현재 /Rotate를 콘텐츠 스트림, 페이지 박스, 주석 사각형에 반영한 뒤 /Rotate를 0으로 되돌려, 회전 표시 힌트에 의존하지 않고도 시각적 레이아웃이 유지되게 합니다

Syntax

function FlattenPageRotation(
  const Options : TPdfFlattenRotationOptions;
  out Report : TPdfFlattenRotationReport): Boolean; overload;

function FlattenPageRotation(
  const PageNumbers : array of Integer;
  const Options : TPdfFlattenRotationOptions;
  out Report : TPdfFlattenRotationReport): Boolean; overload;

Description

많은 다운스트림 도구(구형 인쇄 파이프라인, 이미지 추출기, OCR 전처리기, 래스터 변환기)는 /Rotate 페이지 항목을 무시하고 회전된 페이지를 잘못된 방향으로 렌더링합니다. FlattenPageRotation은 현재 회전의 역변환을 페이지 콘텐츠, 주석 사각형, 페이지 박스에 적용한 뒤 /Rotate를 0으로 설정합니다. 호출 후 보이는 페이지는 회전된 원본과 동일하지만 더 이상 뷰어가 회전 힌트를 적용할 필요가 없습니다

인자 하나짜리 오버로드는 모든 페이지를 처리하고, PageNumbers 오버로드는 0 기반 배열을 받아 일부 페이지만 평탄화할 수 있습니다. 이미 /Rotate=0인 페이지는 Report.SkippedPageCount에 집계되며 그대로 둡니다

내부적으로 회전된 각 페이지는 콘텐츠에 대해 FPDFPage_CountObjects + FPDFPage_GetObject + FPDFPageObj_TransformF를, 그다음 주석에 대해 FPDFPage_GetAnnot + FPDFAnnot_GetRect / FPDFAnnot_SetRect를, 그다음 페이지 박스에 대해 FPDFPage_SetMediaBox / FPDFPage_SetCropBox를 실행하고 마지막으로 FPDFPage_SetRotation을 0으로 호출합니다. 행렬은 FPDFPage_GetMediaBox가 반환한 회전 전 MediaBox에서 유도됩니다

Parameters

Remarks

Example

var
  Options: TPdfFlattenRotationOptions;
  Report: TPdfFlattenRotationReport;
begin
  Pdf1.FileName := 'C:\Scanned.pdf';
  Pdf1.Active := True;
  Options := TPdfFlattenRotationOptions.Default;
  Pdf1.FlattenPageRotation(Options, Report);
  Pdf1.SaveAs('C:\Scanned_flat.pdf');
end;

See Also

PageRotation, TransformPageObject, SetPageBox