SetaPDF_Core_PageFormats Class for getting and handling page formats

File: /SetaPDF v2/Core/PageFormats.php

Class hierarchy

Summary

Constants

A3

const string SetaPDF_Core_PageFormats::A3 = 'a3'

Page format constant

A4

const string SetaPDF_Core_PageFormats::A4 = 'a4'

Page format constant

A5

const string SetaPDF_Core_PageFormats::A5 = 'a5'

Page format constant

LEGAL

const string SetaPDF_Core_PageFormats::LEGAL = 'legal'

Page format constant

LETTER

const string SetaPDF_Core_PageFormats::LETTER = 'letter'

Page format constant

ORIENTATION_AUTO

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

ORIENTATION_LANDSCAPE

Landscape orientation

ORIENTATION_PORTRAIT

Portrait orientation


Static Properties

$formats

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

width, height

Formats in default user space (points) in portrait orientation


Static Methods

getAsBoundary()

public static SetaPDF_Core_PageFormats::getAsBoundary (
string|array $format [, string $orientation = self::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 = self::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 = self::ORIENTATION_PORTRAIT ]
): integer

Get the height of a page format.

Parameters
$format : string|array
 
$orientation : string
 

getWidth()

public static SetaPDF_Core_PageFormats::getWidth (
string|array $format [, string $orientation = self::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.