SetaPDF_Core_PageFormats Class for getting and handling page formats

File: /SetaPDF v2/Core/PageFormats.php

Class hierarchy

Summary

Constants

A3

public const string SetaPDF_Core_PageFormats::A3 = 'a3'

Page format constant

A4

public const string SetaPDF_Core_PageFormats::A4 = 'a4'

Page format constant

A5

public const string SetaPDF_Core_PageFormats::A5 = 'a5'

Page format constant

LEGAL

public const string SetaPDF_Core_PageFormats::LEGAL = 'legal'

Page format constant

LETTER

public const string SetaPDF_Core_PageFormats::LETTER = 'letter'

Page format constant

ORIENTATION_AUTO

public const string SetaPDF_Core_PageFormats::ORIENTATION_AUTO = 'auto'

If this orientation is used the 0 key will be the width while 1 will hold the height

ORIENTATION_LANDSCAPE

public const string SetaPDF_Core_PageFormats::ORIENTATION_LANDSCAPE = 'landscape'

Landscape orientation

ORIENTATION_PORTRAIT

public const string SetaPDF_Core_PageFormats::ORIENTATION_PORTRAIT = 'portrait'

Portrait orientation


Static Properties

$formats

static public array SetaPDF_Core_PageFormats::$formats = array(...)

Formats in default user space (points) in portrait orientation

width, height


Static Methods

getAsBoundary()

public static SetaPDF_Core_PageFormats::getAsBoundary (
string|array $format [, string $orientation = SetaPDF_Core_PageFormats::ORIENTATION_PORTRAIT [, string $boundaryName = null ]]
): SetaPDF_Core_Type_Array|SetaPDF_Core_Type_Dictionary_Entry

Get a page format as a boundary rect as a SetaPDF_Core_Type_Array.

Parameters
$format : string|array
 
$orientation : string
 
$boundaryName : string
 

getFormat()

public static SetaPDF_Core_PageFormats::getFormat (
string|array $format [, string $orientation = SetaPDF_Core_PageFormats::ORIENTATION_PORTRAIT ]
): array

Returns a normalized format by a page format name or by an array.

Parameters
$format : string|array

The format as an array with 2 values or a pre-defined format constant

$orientation : string

The orientation

Return Values

Array where the keys '0' and 'width' are the width and keys '1' and 'height' are the height.

Exceptions

Throws InvalidArgumentException

getHeight()

public static SetaPDF_Core_PageFormats::getHeight (
string|array $format [, string $orientation = SetaPDF_Core_PageFormats::ORIENTATION_PORTRAIT ]
): integer

Get the height of a page format.

Parameters
$format : string|array
 
$orientation : string
 

getOrientation()

public static SetaPDF_Core_PageFormats::getOrientation (
int|float $width, int|float $height
): string

Returns the orientation using width and height.

Parameters
$width : int|float
 
$height : int|float
 
Return Values

See SetaPDF_Core_PageFormats::ORIENTATION_XXX constants

getWidth()

public static SetaPDF_Core_PageFormats::getWidth (
string|array $format [, string $orientation = SetaPDF_Core_PageFormats::ORIENTATION_PORTRAIT ]
): integer

Get the width of a page format.

Parameters
$format : string|array
 
$orientation : string
 

is()

public static SetaPDF_Core_PageFormats::is (
string|array $format, array|SetaPDF_Core_Document_Page|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Geometry_Rectangle $rect [, int|float $threshold = 1 ]
): boolean|string

Checks if a rectangle is approximately the same size as a given format.

Parameters
$format : string|array

The format as an array or as one of the defined page formats

$rect : array|SetaPDF_Core_Document_Page|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Geometry_Rectangle

The rectangle or the page that needs to be compared

$threshold : int|float

The allowed difference between the rectangle and the format

Return Values

false or a string containing the matched orientation.