@cityssm/paper-sizes
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Paper Sizes for Node

npm (scoped) DeepSource Maintainability codecov Coverage Testing

Retrieves exact dimensions for common paper sizes.

Unlike other "paper size" packages, this package returns sizes in their specified units.

  • North American paper sizes (including ANSI and Arch) are returned in inches.
  • ISO paper sizes are returned in millimetres.

This avoids strange paper sizes (like Letter paper set at 215.9 mm x 279.4 mm) when used in conjunction with report generating tools, like @cityssm/pdf-puppeteer.

That being said, helper functions are included to return dimensions in either inches or millimetres with three-decimal-digit precision.

Installation

npm install @cityssm/paper-sizes

Usage

import { getPaperSize, getPaperSizeInMillimetres } from '@cityssm/paper-sizes'

console.log(getPaperSize('A4'))
// => { width: 210, height: 297, unit: 'mm' }

console.log(getPaperSize('Letter'))
// => { "width": 8.5, "height": 11, "unit": "in" }

console.log(getPaperSizeInMillimetres('Letter'))
// => { "width": 215.9, "height": 279.4, "unit":"mm" }

More Exports

Functions

  • isPaperType(possiblePaperType)
  • isNorthAmericanPaperType(possiblePaperType)
  • isIsoPaperType(possiblePaperType)
  • getLandscapePaperSize(paperType)

Paper Specification Constants

  • paperSpecifications
  • northAmericanPaperSpecifications, commonNorthAmericanPaperSpecifications
  • ansiPaperSpecifications, archPaperSpecifications
  • isoPaperSpecifications
  • aSeriesPaperSpecifications, bSeriesPaperSpecifications, cSeriesPaperSpecifications

Related Projects

PDF Puppeteer
A simple npm package to convert HTML to PDF for Node.js applications by using Puppeteer.

Package Sidebar

Install

npm i @cityssm/paper-sizes

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

44.8 kB

Total Files

21

Last publish

Collaborators

  • dgowans