Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxPDFPageInfo.Pack Method

In This Article

Removes temporary objects associated with the page.

#Declaration

Delphi
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