guess-paper-size

1.0.4 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i guess-paper-size

Weekly Downloads

5

Version

1.0.4

License

CC0-1.0

Last publish

Collaborators

  • sli