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

@shznet/pdf-sign-react

v1.0.1

Published

React wrapper for @shznet/pdf-sign-control

Readme

@shznet/pdf-sign-react

React component wrapper for @shznet/pdf-sign-control.

Installation

npm install @shznet/pdf-sign-react

Usage

import { PdfSignReact, PdfSignReactRef } from '@shznet/pdf-sign-react';
import { useRef } from 'react';

export function App() {
  const controlRef = useRef<PdfSignReactRef>(null);

  const handlePdfLoaded = () => {
    console.log('PDF Loaded!');
  };

  return (
    <div style={{ height: '100vh' }}>
      <PdfSignReact 
        ref={controlRef}
        src="https://example.com/doc.pdf"
        viewMode="scroll"
        zoomable={true}
        onLoad={handlePdfLoaded}
      />
    </div>
  );
}
<button onClick={() => controlRef.current?.print()}>
  Print PDF
</button>

Props

| Prop | Type | Description | |------|------|-------------| | src | string \| Uint8Array \| ArrayBuffer | PDF source to load. | | page | number | Current page number (1-based). Supports two-way binding via state. | | viewMode | 'single' \| 'scroll' | View mode - changes trigger re-render. | | scale | number | Zoom scale - changes trigger re-render. | | zoomable | boolean | Enable/disable gesture zooming (default: true). | | fields | SignatureField[] | Controlled fields list. | | pdfLoaderOptions | PdfLoaderOptions | PDF.js configuration (workerSrc, etc.). | | onReady | (control: PdfSignControl) => void | Callback when control is initialized. | | onLoad | () => void | Callback when PDF is loaded. | | onPageChange | (page: number, total: number) => void | Callback when page changes (enables two-way binding). | | onScaleChange | (scale: number) => void | Callback when zoom level changes. | | onFieldsChange | (fields: SignatureField[]) => void | Callback when fields are modified. | | onSelectionChange | (data: { field: SignatureField | null }) => void | Callback when field selection changes. | | onError | (error: Error) => void | Callback on errors. |

Two-Way Binding Example

import { PdfSignReact } from '@shznet/pdf-sign-react';
import { useState } from 'react';

export function App() {
  const [currentPage, setCurrentPage] = useState(1);
  const [totalPages, setTotalPages] = useState(0);
  const [scale, setScale] = useState(1.0);

  return (
    <div>
      <div>
        <button onClick={() => setCurrentPage(p => Math.max(1, p - 1))}>
          Previous
        </button>
        <span>Page {currentPage} / {totalPages}</span>
        <button onClick={() => setCurrentPage(p => Math.min(totalPages, p + 1))}>
          Next
        </button>
        
        <button onClick={() => setScale(s => s + 0.25)}>Zoom In</button>
        <button onClick={() => setScale(s => Math.max(0.25, s - 0.25))}>Zoom Out</button>
      </div>

      <PdfSignReact
        src="https://example.com/doc.pdf"
        page={currentPage}
        scale={scale}
        onPageChange={(page, total) => {
          setCurrentPage(page);  // Two-way binding
          setTotalPages(total);
        }}
        onScaleChange={setScale}  // Two-way binding
        style={{ height: '600px' }}
      />
    </div>
  );
}

Ref Methods

Access methods via ref for imperative control:

const pdfRef = useRef<PdfSignReactRef>(null);

// Navigation
pdfRef.current?.goToPage(5);
pdfRef.current?.nextPage();
pdfRef.current?.previousPage();
const currentPage = pdfRef.current?.getCurrentPage();
const totalPages = pdfRef.current?.getTotalPages();

// Zoom
pdfRef.current?.setScale(1.5);
const scale = pdfRef.current?.getScale();

// View Mode
await pdfRef.current?.setViewMode('single');
const mode = pdfRef.current?.getViewMode();

// Page Dimensions
const dims = await pdfRef.current?.getPageDimensions(1); // Page 1 (1-based index)
console.log(`Page size: ${dims?.width} x ${dims?.height} points`);

// Field Management
await pdfRef.current?.addField({
  id: 'sig1',
  pageNumber: 1,
  rect: { x: 100, y: 100, width: 200, height: 80 },
  type: 'signature',
  content: '<svg>...</svg>',
  draggable: true,
  resizable: true
});

pdfRef.current?.removeField('sig1');
pdfRef.current?.updateField('sig1', { rect: { x: 150, y: 150, width: 200, height: 80 } });
const fields = pdfRef.current?.getFields();
pdfRef.current?.clearFields();

// Printing
await pdfRef.current?.print({ withSignatures: false });

// Direct Control Access
const control = pdfRef.current?.getControl();