PDFium Delphi Component Docs

PageBox property

Component: TPdf  ·  Unit: PDFium
Page-level property — reads or writes a specific page-box rectangle on the current page

Syntax

property PageBox[Box: TPdfPageBox]: TPdfRectangle;

Description

Reads or writes a specific page-box rectangle (pbMedia, pbCrop, pbBleed, pbTrim, or pbArt) on the current page. The value is sourced from the page dictionary in the PDF after resolving any inherited /MediaBox or /CropBox from parent page-tree nodes

Assigning a TPdfRectangle to PageBox[Box] updates the corresponding box on the active page (equivalent to calling SetPageBox)

Coordinates and dimensions are reported in PDF user-space points. To convert to pixels for a target DPI, use PointsToPixels(Value, DPI) or the equivalent helpers

Parameters

BoxWhich page box to retrieve: pbMedia / pbCrop / pbBleed / pbTrim / pbArt

Remarks

Example

var
  R: TPdfRectangle;
begin
  if Pdf1.Active then
  begin
    R := Pdf1.PageBox[pbMedia];
    Memo1.Lines.Add(Format('%.2f x %.2f pt', [R.Right - R.Left, R.Top - R.Bottom]));
  end;
end;

See Also

PageBounds, GetPageBox, SetPageBox