Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

modern-idoc

qq157251.1kMIT0.6.14TypeScript support: included

Intermediate document for modern codec libs

idoc, intermediate-document, typescript

readme

modern-idoc

Minzip Version Downloads Issues License

Usage

import type { Document } from 'modern-idoc'

const pdf: Document = {
  children: [
    {
      style: { width: 300, height: 600 },
      children: [
        {
          style: {
            rotate: 60,
            width: 50,
            height: 50,
          },
          background: '/example.png',
        },
        {
          style: {
            rotate: 40,
            left: 100,
            top: 100,
            fontSize: 20,
            color: '#FF00FF',
          },
          text: 'test',
        },
        {
          style: {
            left: 200,
            top: 100,
            width: 100,
            height: 200,
            fontSize: 22,
          },
          text: [
            {
              letterSpacing: 3,
              fragments: [
                {
                  content: 'He',
                  color: '#00FF00',
                  fontSize: 12,
                },
                { content: 'llo', color: '#000000' },
              ],
            },
            { content: ', ', color: '#FF0000' },
            { content: 'World!', color: '#0000FF' },
          ],
        },
      ],
    },
  ],
}

Types

view d.ts type file

Refer to these packages for usage

changelog

0.6.14 (2025-06-11)

Features

0.6.13 (2025-06-10)

Bug Fixes

0.6.12 (2025-06-10)

Bug Fixes

Features

0.6.11 (2025-06-10)

Bug Fixes

0.6.10 (2025-06-10)

Bug Fixes

  • NormalizedTextContent type (1e27102)

0.6.9 (2025-05-23)

Bug Fixes

0.6.8 (2025-05-23)

Bug Fixes

0.6.7 (2025-05-23)

Bug Fixes

0.6.6 (2025-05-23)

Features

  • support svg prop in NormalizedShape (3111ce9)

0.6.5 (2025-05-23)

Bug Fixes

0.6.4 (2025-05-22)

Features

  • style add fill and outline type (041feab)

0.6.3 (2025-05-22)

Bug Fixes

0.6.2 (2025-05-22)

Bug Fixes

0.6.1 (2025-05-22)

Bug Fixes

Features

  • rename geometry to shape (0554ae2)
  • rename SolidFill to ColorFill, add PresetFill, rename withGeometry to fillWithShape, add normalizeGradientFill (ba995a5)
  • type name semantic adjust (8d74456)
  • type name semantic adjust (f38da4d)

0.6.0 (2025-05-21)

Features

0.5.6 (2025-05-21)

Features

  • normalize color to hex8 (f9415b6)

0.5.5 (2025-05-20)

Features

  • normalizeColor fixed to rgba string (5c355c4)

0.5.4 (2025-05-10)

Bug Fixes

0.5.3 (2025-05-06)

Features

0.5.2 (2025-04-25)

Features

0.5.1 (2025-04-23)

Features

0.5.0 (2025-04-23)

Features

0.4.5 (2025-04-18)

Features

  • add Outline LineEnd define (9ab52b7)
  • add withGeometry prop to background and foreground (bc1ca65)

0.4.4 (2025-04-16)

Features

0.4.3 (2025-04-12)

Bug Fixes

0.4.2 (2025-04-11)

Bug Fixes

0.4.1 (2025-04-11)

Features

  • add effect prop to element (1da185a)

0.4.0 (2025-04-10)

Features

0.3.5 (2025-04-07)

Features

0.3.4 (2025-04-04)

Bug Fixes

0.3.3 (2025-04-03)

Features

0.3.2 (2025-04-03)

Features

0.3.1 (2025-04-03)

Bug Fixes

  • SingleBackgroundDeclaration (71cb72b)

0.3.0 (2025-04-03)

Features

0.2.13 (2025-03-21)

Features

  • add ImageFillStretch type (94cd4e7)

0.2.12 (2025-03-11)

Features

0.2.11 (2025-03-11)

Bug Fixes

Features

0.2.10 (2025-03-11)

Bug Fixes

0.2.9 (2025-03-11)

Features

0.2.8 (2025-02-27)

Features

0.2.7 (2025-02-27)

Bug Fixes

0.2.6 (2025-02-27)

Features

0.2.5 (2025-02-21)

Features

  • IDOCDocumentDeclaration (433d231)

0.2.4 (2025-02-21)

Features

0.2.3 (2025-02-21)

Features

0.2.2 (2025-02-21)

Features

0.2.1 (2025-02-21)

Features

0.2.0 (2025-02-20)

Features

0.1.5 (2025-01-03)

Bug Fixes

0.1.4 (2025-01-02)

Bug Fixes

0.1.3 (2024-12-30)

0.1.2 (2024-12-27)

Features

0.1.1 (2024-12-27)

Features

0.1.0 (2024-12-27)

Features

0.0.3 (2024-12-25)

Features

0.0.2 (2024-12-25)

Bug Fixes

Features

  • add getDefaultTextStyle and getDefaultElementStyle util methods (cb50348)
  • add IElementType enum (2e3064c)

0.0.1 (2024-12-24)

Features