Skip to content

@shbernal/ts-pptx


@shbernal/ts-pptx / index / coordToEmu

Function: coordToEmu()

coordToEmu(value, axisEmu): Emu

Defined in: src/units.ts:125

The single user-coordinate → EMU boundary. Convert each user-supplied coordinate exactly once.

Accepts (see Coord):

  • a bare numberalways inches (the documented unit); no magnitude guessing
  • "<n>%" → percentage of axisEmu
  • "<n>in" / "<n>pt" / "<n>px" / "<n>emu" → explicit units (the escape hatch for non-inch values). px is resolved at DEFAULT_PX_PER_INCH (96), for authoring against a known web/source canvas size.

Throws on non-finite or unparseable input rather than silently emitting a degenerate 0-size.

Parameters

value

string | number

user coordinate

axisEmu

number

axis length in EMU, used only to resolve percentages

Returns

Emu