Box

Box API reference

Namespace: Com\Tecnick\Pdf\Page

abstract class Box extends Mode

Extends: Mode

Source: src/Box.php:227

Types

PageBci

array{
  'color': string,
  'width': float,
  'style': string,
  'dash': array<float|int>,
}

PageBox

array{
  'llx': float,
  'lly': float,
  'urx': float,
  'ury': float,
  'bci'?: PageBci,
}

PageBciInput

array{
  'color'?: string,
  'width'?: float,
  'style'?: string,
  'dash'?: array<float|int>,
}

PageBoxInput

array{
  'llx'?: float,
  'lly'?: float,
  'urx'?: float,
  'ury'?: float,
  'bci'?: PageBciInput,
}

PageDataBox

array{
  'llx': float,
  'lly': float,
  'urx': float,
  'ury': float,
  'bci': PageBci,
}

MarginData

array{
    'CB': float,
    'CT': float,
    'FT': float,
    'HB': float,
    'PB': float,
    'PL': float,
    'PR': float,
    'PT': float,
}

PageMarginData

array{
    'booklet': bool,
    'CB': float,
    'CT': float,
    'FT': float,
    'HB': float,
    'PB': float,
    'PL': float,
    'PR': float,
    'PT': float,
}

RegionData

array{
    'RB': float,
    'RH': float,
    'RL': float,
    'RR': float,
    'RT': float,
    'RW': float,
    'RX': float,
    'RY': float,
    'x' : float,
    'y' : float,
}

NoWriteArea

array{
    'side'?: string,
    'xt'?: float,
    'yt'?: float,
    'xb'?: float,
    'yb'?: float,
    'x'?: float,
    'y'?: float,
    'w'?: float,
    'h'?: float,
}

TransitionInput

array{
    'B'?: bool,
    'D'?: int,
    'Di'?: string|int,
    'Dm'?: string,
    'Dur'?: float,
    'M'?: string,
    'S'?: string,
    'SS'?: float,
}

TransitionData

array{
    'B': bool,
    'D': int,
    'Di': string|int,
    'Dm': string,
    'Dur': float,
    'M': string,
    'S': string,
    'SS': float,
}

PageData

array{
    'annotrefs': array<int,int>,
    'autobreak': bool,
    'box': array<string, PageDataBox>,
    'columns': int,
    'content': array<string>,
    'content_mark': array<int>,
    'ContentHeight': float,
    'ContentWidth': float,
    'FooterHeight': float,
    'HeaderHeight': float,
    'currentRegion': int,
    'format': string,
    'group': int,
    'height': float,
    'margin': PageMarginData,
    'n': int,
    'num': int,
    'orientation': string,
    'pagenum': int,
    'pheight': float,
    'pid': int,
    'pwidth': float,
    'region': array<int, RegionData>,
    'rotation': int,
    'time': int,
    'transition'?: TransitionData,
    'width': float,
    'zoom': float,
}

PageInputData

array{
    'annotrefs'?: array<int,int>,
    'autobreak'?: bool,
    'box'?: array<string, PageBoxInput>,
    'columns'?: int,
    'content'?: array<string>|string,
    'content_mark'?: array<int>,
    'ContentHeight'?: float,
    'ContentWidth'?: float,
    'FooterHeight'?: float,
    'HeaderHeight'?: float,
    'currentRegion'?: int,
    'format'?: string,
    'group'?: int,
    'height'?: float,
    'margin'?: array{
        'booklet'?: bool,
        'CB'?: float,
        'CT'?: float,
        'FT'?: float,
        'HB'?: float,
        'PB'?: float,
        'PL'?: float,
        'PR'?: float,
        'PT'?: float,
    },
    'n'?: int,
    'num'?: int,
    'orientation'?: string,
    'pagenum'?: int,
    'pheight'?: float,
    'pid'?: int,
    'pwidth'?: float,
    'region'?: array<int, array{
        'RB'?: float,
        'RH'?: float,
        'RL'?: float,
        'RR'?: float,
        'RT'?: float,
        'RW'?: float,
        'RX'?: float,
        'RY'?: float,
        'x' ?: float,
        'y' ?: float,
    }>,
    'rotation'?: int,
    'time'?: int,
    'transition'?: TransitionInput,
    'width'?: float,
    'zoom'?: float,
}

Constants

BOX

Page box names.

public const BOX = ['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']

Source: src/Box.php:251

Methods

setBox()

Set page boundaries.

public setBox(
    array<string,PageBox> $dims,
    string|PageBoxType $type,
    float $llx,
    float $lly,
    float $urx,
    float $ury,
    ?PageBciInput $bci = null
): array<string,PageBox>

Parameters:

  • $dims (array<string,PageBox>): Array of page dimensions to modify.
  • $type (string|PageBoxType): Box type: MediaBox, CropBox, BleedBox, TrimBox, ArtBox, or enum case.
  • $llx (float): Lower-left x coordinate in user units.
  • $lly (float): Lower-left y coordinate in user units.
  • $urx (float): Upper-right x coordinate in user units.
  • $ury (float): Upper-right y coordinate in user units.
  • $bci (?PageBciInput): BoxColorInfo: guideline style (color, width, style, dash). Missing entries are filled with the default style.

Returns: array<string,PageBox>: Page dimensions.

Throws:

Source: src/Box.php:303

setPageBoxes()

Initialize page boxes.

public setPageBoxes(float $width, float $height): array<string,PageBox>

Parameters:

  • $width (float): Page width in points.
  • $height (float): Page height in points.

Returns: array<string,PageBox>: Page boxes.

Throws:

Source: src/Box.php:484

swapCoordinates()

Swap X and Y coordinates of page boxes (change page boxes orientation).

public swapCoordinates(array<string,PageBox> $dims): array<string,PageBox>

Parameters:

  • $dims (array<string,PageBox>): Array of page dimensions.

Returns: array<string,PageBox>: Page dimensions.

Source: src/Box.php:266

Inherited members

From Format

From Mode