PDFium Delphi Component Docs

ImportPagesByIndex Yöntem

Component: TPdf  ·  Unit: PDFium
Başka bir TPdf içinden, sıfır tabanlı dizinlere göre belirli bir sayfa alt kümesini içe aktarır ve geçerli belgedeki ekleme noktasını denetlemenizi sağlar

Sözdizimi

function ImportPagesByIndex(
  Source : TPdf;
  const PageIndices: array of Integer;
  InsertAt : Integer = 0): Boolean;

Açıklama

ImportPagesByIndex copies an explicit set of pages from Source into THIS document. Unlike ImportPages, which parses a one-based range string ("1-3,7,10-12"), ImportPagesByIndex takes the indices directly as a zero-based Pascal open array — ideal when the page list comes from program logic (a checked list of thumbnails, a filtered query, etc.)

InsertAt, İLK içe aktarılan sayfanın sıfır tabanlı hedef indeksidir: mevcut 1. sayfadan önce eklemek için 0, sona eklemek için PageCount geçin. Aralık dışı InsertAt değerleri PDFium tarafından kırpılır

Her sayfayı Source'tan içe aktarmak için boş bir PageIndices dizisi geçin (C ABI düzeyinde nil geçmekle eşdeğerdir). Her şeyi tek çağrıda içe aktarmanın kısa yolu budur

Returns True on success. Returns False if any index is out of range in Source or if either document is not Active. Raises EPdfError when Source is nil

Notlar

Örnek

var
  Source: TPdf;
begin
  Source := TPdf.Create(nil);
  try
    Source.FileName := 'C:\Report.pdf';
    Source.Active := True;
    // Import pages 1, 3, 5 (zero-based: 0, 2, 4) and append
    Pdf1.ImportPagesByIndex(Source, [0, 2, 4], Pdf1.PageCount);
    // Or import every source page at the start of Pdf1
    // Pdf1.ImportPagesByIndex(Source, [], 0);
  finally
    Source.Free;
  end;
end;

Ayrıca bkz.

ImportPages, ImportNPagesToOne, MovePages