🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

modern-pdf

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modern-pdf

Generate PDF in a way that describes the DOM.

1.2.6
latest
Source
npm
Version published
Weekly downloads
319
61.93%
Maintainers
1
Weekly downloads
 
Created
Source

modern-pdf

Minzip Version Downloads Issues License

Usage

import { PDF } from 'modern-pdf'

const pdf = new PDF({
  // meta: {
  //   colorSpace: 'cmyk',
  // },
  children: [
    {
      name: 'page1',
      style: { width: 300, height: 600 },
      children: [
        {
          style: { rotate: 60, width: 50, height: 50 },
          image: '/assets/test.jpg',
        },
        {
          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' },
          ],
        },
      ],
    },
  ],
})

pdf.save('download.pdf')

Keywords

pdf

FAQs

Package last updated on 16 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts