PHPackages                             ycdev/paper-size - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ycdev/paper-size

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ycdev/paper-size
================

Paper Size constant and convert to inch/pixe

V0.2.2(3mo ago)125GPL-3.0-or-laterPHP

Since May 20Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/CymDeveloppement/PaperSize)[ Packagist](https://packagist.org/packages/ycdev/paper-size)[ RSS](/packages/ycdev-paper-size/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (2)Versions (8)Used By (0)

PaperSize
=========

[](#papersize)

A PHP class for managing paper formats and their conversions.

Installation
------------

[](#installation)

```
composer require ycdev/paper-size
```

Supported Paper Formats
-----------------------

[](#supported-paper-formats)

### ISO Formats

[](#iso-formats)

FormatDimensions (mm)DescriptionA0841 × 1189Largest standard ISO formatA1594 × 841Half of A0A2420 × 594Half of A1A3297 × 420Half of A2A4210 × 297Standard paper sizeA5148 × 210Half of A4A6105 × 148Half of A5A774 × 105Half of A6A852 × 74Half of A7A937 × 52Half of A8A1026 × 36Half of A9### B Series (ISO)

[](#b-series-iso)

FormatDimensions (mm)DescriptionB01000 × 1414Largest B series formatB1707 × 1000Half of B0B2500 × 707Half of B1B3353 × 500Half of B2B4250 × 353Half of B3B5176 × 250Half of B4B6125 × 176Half of B5B788 × 125Half of B6B862 × 88Half of B7B944 × 62Half of B8B1031 × 44Half of B9### C Series (ISO)

[](#c-series-iso)

FormatDimensions (mm)DescriptionC0917 × 1297Largest C series formatC1648 × 917Half of C0C2458 × 648Half of C1C3324 × 458Half of C2C4229 × 324Half of C3C5162 × 229Half of C4C6114 × 162Half of C5C781 × 114Half of C6C857 × 81Half of C7C940 × 57Half of C8C1028 × 40Half of C9### US Formats

[](#us-formats)

FormatDimensions (mm)DescriptionUS Letter216 × 279Standard US paper sizeUS Executive184 × 267Executive sizeUS Government Letter203 × 267Government documentsUS Quarto229 × 279Quarto sizeUS Foolscap Folio216 × 330Foolscap folio sizeUS Half Letter140 × 216Half of US LetterUS Junior Legal140 × 216Junior legal size### French Formats (AFNOR)

[](#french-formats-afnor)

FormatDimensions (mm)DescriptionCloche300 × 400Pot310 × 400Tellière340 × 440Ancienne administration françaiseCouronne écriture360 × 460Couronne édition370 × 470Roberto390 × 500Dessin anatomiqueÉcu400 × 520Coquille440 × 560Surface proche du A2Carré450 × 560Cavalier460 × 620Format publicitaire en presseQuart-raisin250 × 325Papier à dessin scolaireDemi-raisin325 × 500DessinRaisin500 × 650DessinDouble raisin650 × 1000Grappe de raisin4000 × 26008 raisinsJésus560 × 760Atlas, sentiers et cheminsSoleil600 × 800Colombier affiche600 × 800Colombier commercial630 × 900Petit Aigle700 × 940Cartes et plansGrand Aigle750 × 1060Plans cadastrauxGrand Monde900 × 1260Univers1000 × 1300### Japanese Formats (JIS P 0138)

[](#japanese-formats-jis-p-0138)

FormatDimensions (mm)JB01030 × 1456JB1728 × 1030JB2515 × 728JB3364 × 515JB4257 × 364JB5182 × 257JB6128 × 182JB791 × 128JB864 × 91JB945 × 64JB1032 × 45JB1122 × 32JB1216 × 22Shiroku Ban 4128 × 182Shiroku Ban 5189 × 262Shiroku Ban 6127 × 188Kiku 4227 × 306Kiku 5151 × 227### ID Formats (ISO/CEI 7810)

[](#id-formats-isocei-7810)

FormatDimensions (mm)DescriptionID-00015 × 25Mini SIMID-154 × 85Carte bancaireID-274 × 105ID-388 × 125PasseportUsage
-----

[](#usage)

### Available Paper Formats

[](#available-paper-formats)

The class includes the following standard formats:

- ISO formats (A0-A10, B0-B10, C0-C10)
- US formats (Letter, Executive, Government Letter, Quarto, etc.)
- French AFNOR formats (Cloche, Raisin, Jésus, Grand Aigle, etc.)
- Japanese JIS formats (JB0-JB12, Shiroku Ban, Kiku)
- ID formats ISO/CEI 7810 (ID-000, ID-1, ID-2, ID-3)

### Usage Examples

[](#usage-examples)

#### Unit Conversion

[](#unit-conversion)

```
use Ycdev\PaperSize;

// Get A4 dimensions in pixels (default 300 DPI)
$dimensions = PaperSize::px(PaperSize::A4);
// Result: [2480, 3508]

// Get A4 dimensions in centimeters
$dimensions = PaperSize::cm(PaperSize::A4);
// Result: [21.0, 29.7]

// Get A4 dimensions in inches
$dimensions = PaperSize::in(PaperSize::A4);
// Result: [8.27, 11.69]
```

#### Creating a GD Image

[](#creating-a-gd-image)

```
use Ycdev\PaperSize;

// Create a GD image with A4 dimensions
$image = PaperSize::gdImage(PaperSize::A4);
```

#### Calculating Aspect Ratio

[](#calculating-aspect-ratio)

```
use Ycdev\PaperSize;

// Get the aspect ratio of A4 format
$ratio = PaperSize::ratio(PaperSize::A4);
// Result: 1.4142
```

#### Landscape Mode

[](#landscape-mode)

```
use Ycdev\PaperSize;

// Convert A4 format to landscape
$landscape = PaperSize::landscape(PaperSize::A4);
// Result: [297, 210]
```

#### List All Available Formats

[](#list-all-available-formats)

```
use Ycdev\PaperSize;

// Get all available formats
$formats = PaperSize::allFormats();
// Returns an associative array:
// [
//     'A4' => ['width' => 210, 'height' => 297, 'name' => 'A4'],
//     'FR_RAISIN' => ['width' => 500, 'height' => 650, 'name' => 'Fr raisin'],
//     ...
// ]

// Example: populate a
foreach (PaperSize::allFormats() as $key => $format) {
    echo "{$format['name']} ({$format['width']}x{$format['height']}mm)";
}
```

> **Breaking change** : `allFormats()` retourne désormais un tableau associatif avec les clés `width`, `height` et `name` au lieu d'un tableau indexé `[width, height, name]`.

#### Detect Format from Pixel Dimensions

[](#detect-format-from-pixel-dimensions)

```
use Ycdev\PaperSize;

// Detect paper format from pixel dimensions
$format = PaperSize::format(2480, 3507);
// Result: 'A4'

// Works in landscape too
$format = PaperSize::format(3507, 2480);
// Result: 'A4'

// Returns false if no match
$format = PaperSize::format(1, 1);
// Result: false
```

#### Crop a GD Image

[](#crop-a-gd-image)

```
use Ycdev\PaperSize;

$image = PaperSize::gdImage(PaperSize::A4);
$cropped = PaperSize::crop($image, PaperSize::A5);
```

Supported Units
---------------

[](#supported-units)

- px (pixels)
- mm (millimeters)
- cm (centimeters)
- m (meters)
- in (inches)

Resolution
----------

[](#resolution)

The default resolution for pixel conversions is 300 DPI. You can modify it when calling the methods:

```
use Ycdev\PaperSize;

// Convert to pixels with 600 DPI resolution
$dimensions = PaperSize::px(PaperSize::A4, 600);
```

License
-------

[](#license)

GPL V3

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance79

Regular maintenance activity

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~74 days

Total

7

Last Release

111d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/024570f0039cd21fa340520a3f616c617734a1634b92a2b5cd137c3954d4c2ec?d=identicon)[cymdev](/maintainers/cymdev)

---

Top Contributors

[![CymDeveloppement](https://avatars.githubusercontent.com/u/7532413?v=4)](https://github.com/CymDeveloppement "CymDeveloppement (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ycdev-paper-size/health.svg)

```
[![Health](https://phpackages.com/badges/ycdev-paper-size/health.svg)](https://phpackages.com/packages/ycdev-paper-size)
```

###  Alternatives

[koehlersimon/slug

Helps you managing the URL slugs of your TYPO3 site

2965.7k](/packages/koehlersimon-slug)[mremi/contact-bundle

Implementation of a contact form for Symfony2

2712.6k2](/packages/mremi-contact-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
