npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ck-create-pdf

v0.2.1

Published

A CLI tool for creating and previewing React PDF templates

Downloads

6

Readme

React PDF Preview

A powerful development tool for previewing and developing PDF templates with @react-pdf/renderer in real-time. Perfect for Next.js projects that need to generate beautiful, dynamic PDFs.

Features

  • 📝 Side-by-side code and PDF preview
  • 🎨 Pre-built professional templates
  • 🔄 Hot reload support
  • 🛠 Easy integration with Next.js projects

Installation

npm install react-pdf-preview --save-dev

Quick Start

1. Create New Templates

Initialize your project with example templates:

pdf-preview create

This will:

  • Create a templates directory in your project
  • Add example templates (invoice, certificate, report, resume)
  • Install required dependencies

You can specify a custom directory:

pdf-preview create --dir ./my-templates

2. Start Development Server

Run the development server to preview your templates:

pdf-preview dev

Options:

  • --dir: Specify templates directory (default: ./templates)
  • --port: Specify port number (default: 3000)
pdf-preview dev --dir ./my-templates --port 3001

Template Development

Basic Template Structure

import React from "react";
import { Document, Page, Text, View, StyleSheet } from "@react-pdf/renderer";

const styles = StyleSheet.create({
  page: {
    flexDirection: "column",
    backgroundColor: "#ffffff",
    padding: 40,
  },
  // ... more styles
});

const MyTemplate: React.FC = () => (
  <Document>
    <Page size="A4" style={styles.page}>
      {/* Your content here */}
    </Page>
  </Document>
);

export default MyTemplate;

Using Templates in Your App

import { PDFViewer } from "@react-pdf/renderer";
import MyTemplate from "../templates/my-template";

function App() {
  return (
    <PDFViewer>
      <MyTemplate />
    </PDFViewer>
  );
}

Included Templates

The create command provides four professional templates to help you get started:

  1. Invoice Template

    • Professional invoice layout
    • Dynamic table structure
    • Automatic calculations
    • Clean, business-ready design
  2. Certificate Template

    • Achievement certificate layout
    • Centered design
    • Signature section
    • Professional typography
  3. Report Template

    • Business report layout
    • Multiple sections
    • Executive summary
    • Financial metrics
    • Key achievements
  4. Resume Template

    • Modern CV layout
    • Skills section with tags
    • Professional experience timeline
    • Education section
    • Contact information

Project Structure

react-pdf-preview/
├── src/
│   ├── app/                 # Next.js app directory
│   ├── components/         # React components
│   │   ├── code-view.tsx   # Code editor component
│   │   ├── pdf-viewer.tsx  # PDF preview component
│   │   └── view-switcher.tsx # View mode switcher
│   └── cli/               # CLI tool implementation
│       ├── commands/      # CLI commands
│       └── utils/         # Utility functions
├── templates/            # PDF templates
├── public/              # Static assets
└── package.json

Development

To contribute or modify the tool:

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Build the CLI:
    npm run build:cli
  4. Link for local development:
    npm link

Configuration

Tailwind CSS

The preview interface uses Tailwind CSS. You can customize the styling by modifying:

  • tailwind.config.ts
  • postcss.config.js
  • src/app/globals.css

Next.js

The tool is built on Next.js. Configuration can be found in:

  • next.config.js
  • tsconfig.json

Requirements

  • Node.js 16.x or higher
  • Next.js project
  • TypeScript (recommended)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.