size([widthOrPageSize], [heightOrOrientation])
Sets the size of the current document, if arguments are given. If only one argument is given, both the width and the height are set to this value. Alternatively, a string can be given as the first argument to apply an existing page size preset ("A4"
, "Letter"
etc.). In this case, either PORTRAIT
or LANDSCAPE
can be used as a second argument to determine the orientation of the page. If no argument is given, an object containing the current document’s width and height is returned.
Type: function
Parameter(s):
- widthOrPageSize {} Optional:
The desired width of the current document or the name of a page size preset.
- heightOrOrientation {} Optional:
The desired height of the current document. If not provided the width will be used as the height. If the first argument is a page size preset, the second argument can be used to set the orientation.
Returns:
-
{Object}:
Object containing the current
width
andheight
of the document.
Example(s):
Sets the document size to 70 x 100 units
size(70, 100);
Sets the document size to 70 x 70
size(70);
Sets the document size to A4, keeps the current orientation in place
size("A4");
Sets the document size to A4, set the orientation to landscape
size("A4", LANDSCAPE);