Module Simantics/PageSettings

This module is undocumented. This is a list of its definitions.

getByName :: String -> PageDesc

Returns the predefined page description that has the given name. The predefined descriptions are Infinite and A0 to A10, all of them in portrait orientation and without margins. Returns null for any other name.

getOrientedHeight :: PageDesc -> Double

Returns the height of the page in millimetres with the orientation taken into account, i.e. the height of the paper in portrait orientation and its width in landscape orientation.

getOrientedWidth :: PageDesc -> Double

Returns the width of the page in millimetres with the orientation taken into account, i.e. the width of the paper in portrait orientation and its height in landscape orientation.

getPageDesc :: Resource -> <ReadGraph> PageDesc

Returns the page description of the given diagram resource. Fails if the diagram has no page description.

pageDesc :: Variable -> <ReadGraph> PageDesc

Returns the page description of the diagram that the given variable represents.

serializePageDesc :: PageDesc -> String

Serializes the page description into the form the diagram editor stores it in: the width, the height, the orientation, the centering, the name and the margins separated from each other. This is not the format that setPageDesc reads.

setGridSize :: Resource -> Double -> <WriteGraph> ()
setGridSize diagram gridSize

Sets the size of the snapping grid of the given diagram resource.

setMarginsVisible :: Resource -> Boolean -> <WriteGraph> ()

Sets whether the page margins are drawn on the given diagram resource.

setPageBordersVisible :: Resource -> Boolean -> <WriteGraph> ()

Sets whether the page borders are drawn on the given diagram resource.

setPageDesc :: Resource -> String -> <WriteGraph> ()
setPageDesc aDiagramResource "<description>"

Sets the specified diagram's page description to match the specified "<description>".

The format of the <description> is the following:

<label>:<orientation>:<widthInMM>:<heightInMM>:<top-margin>:<bottom-margin>:<left-margin>:<right-margin>

Simantics versions 1.58.0 and later also support an optional <centering> parameter:

<label>:<orientation>:<widthInMM>:<heightInMM>:<top-margin>:<bottom-margin>:<left-margin>:<right-margin>[:<centering>]

where

<orientation> = Portrait | Landscape
<centering>   = TopLeftAtOrigin | CenteredAroundOrigin

Examples:

import "Simantics/Diagram"
import "Simantics/DiagramMapping"
import "Simantics/PageSettings"

composite = diagram currentModel ["NewGenericDiagram"]
diag = diagramOf composite
print $ uriOf composite
print $ uriOf diag

setPageDesc diag "A4:Portrait:210.0:297.0:10.0:10.0:10.0:10.0"
setPageDesc diag "A4:Landscape:210.0:297.0:10.0:10.0:10.0:10.0"
setPageDesc diag "Custom:Landscape:Infinity:Infinity:10.0:10.0:10.0:10.0"

// And since Simantics 1.58.0, the following also work
setPageDesc diag "A4:Landscape:210.0:297.0:10.0:10.0:10.0:10.0:TopLeftAtOrigin"
setPageDesc diag "A4:Landscape:210.0:297.0:10.0:10.0:10.0:10.0:CenteredAroundOrigin"
setPageDescRes :: Resource -> PageDesc -> <WriteGraph> ()

Sets the page description of the given diagram resource. The same as setPageDesc but takes a PageDesc instead of the string description.