PDFium Component Docs

MovePages 메서드

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
컴포넌트: TPdf  ·  유닛: PDFium
0부터 시작하는 index로 이 document의 page를 제자리에서 재정렬하며 page count는 그대로 유지합니다

구문

function MovePages(
  const PageIndices: array of Integer;
  DestPageIndex : Integer): Boolean;

설명

MovePages는 THIS document의 page를 재정렬합니다. PageIndices는 이동할 page의 0부터 시작하는 index를 담습니다(순서는 상관없고, 개수는 PageCount까지 가능합니다). DestPageIndex는 이동이 끝난 뒤 첫 번째로 이동한 page의 destination index입니다. 다른 page는 이동된 block 주위를 따라 이동하므로 document length는 그대로 유지됩니다

예: page가 [0, 1, 2, 3, 4]인 5-page document에서 MovePages([2, 3], 0)은 다음을 만듭니다 [2, 3, 0, 1, 4] — pages 2 and 3 are lifted out, page 0 shifts to position 2 (where page 2 was), page 1 shifts to position 3, and page 4 stays put.

Returns True on success. Returns False if any index in PageIndices is out of range, if DestPageIndex is out of range, or if PageIndices contains duplicates.

This is the right call for "move selected thumbnails up / down" / drag-and-drop page reordering in a UI. To copy a subset of pages from another document, use ImportPagesByIndex; to delete pages, use DeletePage.

비고

예제

// In a 5-page document, move pages 2 and 3 to the start.
// Result: [2, 3, 0, 1, 4]
if not Pdf1.MovePages([2, 3], 0) then
  ShowMessage('Invalid indices passed to MovePages');

// Reverse the entire document
var
  I: Integer;
  Indices: array of Integer;
begin
  SetLength(Indices, Pdf1.PageCount);
  for I := 0 to High(Indices) do
    Indices[I] := High(Indices) - I;
  Pdf1.MovePages(Indices, 0);
end;

참고 항목

ImportPagesByIndex, ImportNPagesToOne, DeletePage, AddPage