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.
Active. Reordering does not change PageCount.PageNumber may end up pointing at a different page after the move — refresh any UI state that tracks the current page.
// 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;