1.0.4 • Published 8 years ago

guess-paper-size v1.0.4

Weekly downloads
2
License
CC0-1.0
Repository
github
Last release
8 years ago

Paper size detector

Build Status

Basic paper size detector.

Install

npm install guess-paper-size

Use

// import guess from 'guess-paper-size';
var guess = require('guess-paper-size');

var width = 210; // mm
var height = 297; // mm

var paper = guess(width, height);
if (paper) {
  console.log('Detected ' + paper.size + ' paper, ' + paper.layout);
}

Test me in your browser using RunKit!

Return value

When found, JavaScript object returned:

  • size - format name (e.g. Letter, A4, B3)
  • layout - landscape or portrait

When not found, return null

Known paper sizes

  • ISO formats: A0...A10; B0...B10; C0...C10
  • US formats: Letter, Legal, Tabloid

Links

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago