THotPDF.GetLoadedPageBox Method

Syntax

function GetLoadedPageBox(
  PageIndex: Integer;
  Box      : THPDFPageBoundary;
  out Left, Bottom, Right, Top: Single): Boolean;

Description

GetLoadedPageBox reads a page boundary from a PDF loaded with LoadFromFile. PageIndex is zero-based and Box accepts pbMediaBox, pbCropBox, pbBleedBox, pbTrimBox, or pbArtBox.

The method returns True when the requested boundary can be resolved. It follows the PDF page-box default chain: a missing CropBox resolves to MediaBox, and a missing BleedBox, TrimBox, or ArtBox resolves to CropBox and then MediaBox.

Example

var
  L, B, R, T: Single;
begin
  PDF.LoadFromFile('Input.pdf');
  if PDF.GetLoadedPageBox(0, pbTrimBox, L, B, R, T) then
    Writeln(Format('TrimBox: %.2f %.2f %.2f %.2f', [L, B, R, T]));
end;

See Also