PDFium Component Docs

MovePages Yöntem

Bu API girdisi tanımlayıcıları, imzaları, kod bloklarını ve PDF terimlerini özgün biçiminde korur.
Bileşen: TPdf  ·  Birim: PDFium
Bu belgenin sayfalarını 0 tabanlı dizine göre yerinde yeniden sıralar ve sayfa sayısını sabit tutar

Söz dizimi

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

Açıklama

MovePages reorders pages of THIS document. PageIndices lists the zero-based indices of the pages to move (any order, any count up to PageCount); DestPageIndex is the destination index for the FIRST moved page after the move completes. Other pages shift around the moved block so the document length stays the same.

Example: in a 5-page document with pages numbered [0, 1, 2, 3, 4], MovePages([2, 3], 0) produces [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.

Döndürür: True on success. Döndürür: 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.

Notlar

Örnek

// 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;

Ayrıca bkz.

ImportPagesByIndex, ImportNPagesToOne, DeletePage, AddPage