Skip to main content

TdxPDFPageInfo.Pack Method

Removes temporary objects associated with the page.

Declaration

procedure Pack;

Remarks

Use the Hyperlinks, Images, and Text fields to retrieve content from the PDF document page. Then, you can call the Pack procedure to clear the copy of the content to free up the memory it occupies. The following code example loads a PDF document and copies all text within it to a TcxMemo control without a PDF Viewer control:

var
  I: Integer;
  ADocument: TdxPDFDocument;
begin
  ADocument := TdxPDFDocument.Create;  // Creates an empty PDF document container
  try
    ADocument.LoadFromFile('MyDocument.pdf');  // Loads a PDF document to the container
    for I := 0 to ADocument.PageCount - 1 do  // Iterates through all document pages
    begin
      cxMemo1.Lines.Add(ADocument.PageInfo[I].Text);  // Appends all text on a page to the cxMemo1 control
      ADocument.PageInfo[I].Pack;  // Frees up the memory that the document page content occupies
    end;
  finally
    ADocument.Free;  // Releases the document container
end;
See Also