Functions
Methods
Metamethods
Fields

Functions

Paper.Paper(options)

Create a new Paper All parameters should be supplied in a table

Parameters

options: A table containing width and height values

Returns

A new Paper table.

Example
local paper = Paper({ width = 210, height = 148})
paper:log()

-- > ❏ Paper [10 paths : width = 210, height = 148]

Methods

Paper:log()

Print a representation of the Paper, including all child paths.

Paper:get_bounds()

Get the bounding box for the Paper Provides values for bounding box width, height, top, bottom, left and right.

As well as Points for top_left, top_center, top_right, middle_left, center, middle_right, bottom_left, bottom_center, and bottom_right.

Returns

A table of bounding box values and Points

Paper:add_paths(paths, index)

Add Paths to the Paper Optionally supply an index to add Paths to a specific place in the Paper.

Parameters

paths: A Path or a table of Paths.

index: An optional index to position the Paths.

Returns

Returns self.

Paper:remove_paths(number_of_paths, index)

Remove a number of Paths from the Paper.

optionally supply and index to remove Paths from a specific position in the Paper.

Parameters

number_of_paths: The number of the Paths to remove.

index: An optional index to remove the Paths from.

Returns

Returns self.

Paper:render_to_string(options)

Render the Paper to string

Parameters

options: A table of functions to render a Paper.

Returns

A string of the rendered Paper.

Paper:render_svg()

Render a SVG for the Paper.

Returns

A an SVG string for the Paper

Paper:save_svg(filename)

Render an SVG and save it to a file.

Parameters

filename: A file to save the SVG to.

Paper:render_hpgl()

Render a HPGL string for the Paper.

Asumes Paper is using mm for units

Returns

A string of the rendered Paper.

Paper:save_hpgl(filename)

Render an HPGL string and save it to a file.

Parameters

filename: A file to save the HPGL to.

Metamethods

paper:__tostring()

Get a representation of the Paper as a string.

Returns

A string representation of the Paper.

Fields

Paper.bounds

The bounding box for the Paper Provides values for bounding box width, height, top, bottom, left and right.

As well as Points for top_left, top_center, top_right, middle_left, center, middle_right, bottom_left, bottom_center, and bottom_right.