Skip to main content

TdxPDFDocument.EndUpdate Method

Re-enables notifications and applies all changes made to the PDF document container and the stored document’s structure after a BeginUpdate call.

Declaration

procedure EndUpdate;

Remarks

An EndUpdate call raises the OnChanged, OnLoaded, and OnUnloaded events only once even if the corresponding changes occurred multiple times since the last BeginUpdate procedure call. Ensure that an EndUpdate call follows every BeginUpdate procedure call, even if an exception occurs.

Example

The following code example deletes the first two pages from the Demo.pdf document file as a single action:

var
  ADocument: TdxPDFDocument;
begin
  ADocument := TdxPDFDocument.Create;
  try
    ADocument.LoadFromFile('Data\Demo.pdf');

    ADocument.BeginUpdate;
    try
      ADocument.Pages.Delete(0);
      ADocument.Pages.Delete(1);
    finally
      ADocument.EndUpdate;
    end;
    ADocument.SaveToFile('Data\Result.pdf');
  finally
    ADocument.Free;
  end;
See Also