New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@pdfn/core

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pdfn/core

Core utilities and constants for pdfn packages

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

@pdfn/core

Shared utilities and constants for pdfn packages.

Note: This is an internal package. Most users should use @pdfn/react directly.

Overview

@pdfn/core provides shared functionality used across the pdfn ecosystem:

  • Page sizes — A4, Letter, Legal, and other standard dimensions
  • CSS utilities — Base styles for PDF rendering
  • Tailwind helpers — Class extraction and marker detection
  • HTML generation — Client-side rendering HTML templates

Installation

npm install @pdfn/core

Entry Points

@pdfn/core (Browser-safe)

The main entry point contains utilities safe for browser bundling:

import {
  // Page sizes
  PAGE_SIZES,
  getPageDimensions,
  getPageSizeCss,

  // CSS utilities
  BASE_STYLES,
  generatePageCss,
  extractPageConfig,

  // Tailwind utilities
  hasTailwindMarker,
  extractPrecompiledCss,
  removeTailwindMarker,

  // HTML generation
  generateClientHtml,
  CLIENT_READY_SCRIPT,
} from '@pdfn/core';

@pdfn/core/tailwind (Server-only)

Server-only Tailwind CSS compilation. Uses Node.js built-ins (fs, path) and fast-glob:

import { compileTailwind } from '@pdfn/core/tailwind';

const { css, classCount, fileCount } = await compileTailwind({
  templatePatterns: ['./pdfn-templates/**/*.tsx'],
  cssPath: './pdfn-templates/styles.css', // optional
  cwd: process.cwd(),
  debug: true,
});

Important: Only import from @pdfn/core/tailwind in server-side code (build plugins, CLI tools). It cannot be bundled for browsers.

Used By

  • @pdfn/react — Uses page sizes, CSS utilities, and Tailwind markers
  • @pdfn/client — Uses HTML generation for client-side rendering
  • @pdfn/next — Uses Tailwind compilation for build-time CSS
  • @pdfn/vite — Uses Tailwind compilation for build-time CSS

License

MIT

Keywords

pdf

FAQs

Package last updated on 04 Feb 2026

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