Constructor
new Size(width, height)
Create a size with pixel dimensions.
Same as calling fromPx.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | the width in pixels. |
height |
number | the height in pixels. |
Classes
Members
(static) paperA3
DIN-A3 paper size.
297x420mm
(static) paperA4
DIN-A4 paper size.
210x297mm
(static) paperA5
DIN-A5 paper size.
148x210mm
(static) paperA6
DIN-A6 paper size.
105x148mm
(static) paperA7
DIN-A7 paper size.
74x105mm
(static) paperCarreL
Carre L - quadratic A4 paper size.
210x210mm
(static) paperHalfLetter
North american half letter size.
5.5x8.5in
(static) paperLetter
North american letter size.
8.5x11in
(static) paperPostcard
North american postcard paper size.
101.6x152.4mm
(static) zero
Zero size.
0x0 pixels.
height
The height in pixels.
height
Set the height in pixels.
width
The width in pixels.
width
Set the size in pixels.
Methods
(static) fromInches(width, height) → {Size}
Create a new size with inch dimensions.
Uses the default CSS spec 96 pixels-per-inch.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | the width in inches |
height |
number | the height in inches |
Returns:
- Type
- Size
(static) fromMillimeters(width, height) → {Size}
Create a size with millimeter dimensions.
Uses the default CSS spec 96 pixels-per-inch.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | the width in millimeters |
height |
number | the height in millimeters |
Returns:
- Type
- Size
(static) fromPx(width, height) → {Size}
Create a size with pixel dimensions.
Same as calling the constructor.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | the width in pixels |
height |
number | the height in pixel |
Returns:
- Type
- Size
(static) max(size1, size2) → {Size}
Returns a new size with the largest width
and largest height of the two supplied sizes.
Parameters:
Name | Type | Description |
---|---|---|
size1 |
Size | the first size |
size2 |
Size | the second size |
Returns:
- Type
- Size
(static) min(size1, size2) → {Size}
Returns a new size with the smallest width
and smallest height of the two supplied sizes.
Parameters:
Name | Type | Description |
---|---|---|
size1 |
Size | first size |
size2 |
Size | second size |
Returns:
- Type
- Size
(static) random() → {Size}
Creates a new size with a random width and height
between 0 and 1.
Returns:
- Type
- Size
landscape() → {Size}
Turn the size landscape.
This makes the shorter dimensions the width and
the longer dimensions the height.
Returns:
- Type
- Size
portrait() → {Size}
Turn the size portrait.
This makes the longer dimension the height and
the shorter dimension the width.
Returns:
- Type
- Size