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-control

v1.0.1

Published

Core PDF signing logic for @shznet/pdf-sign

Readme

@shznet/pdf-sign-control

The core engine for the @shznet/pdf-sign ecosystem. It provides a framework-agnostic class PdfSignControl to render PDFs and manage interactive signature fields.

Installation

npm install @shznet/pdf-sign-control pdfjs-dist

Usage

import { PdfSignControl } from '@shznet/pdf-sign-control';

// 1. Initialize the control
const container = document.getElementById('pdf-wrapper');
const pdfControl = new PdfSignControl({
  container: container,
  viewMode: 'scroll', // 'single' or 'scroll'
  // pdfLoaderOptions: { ... }
});

// 2. Load a PDF
await pdfControl.load('https://example.com/sample.pdf');

// 3. Add a signature field
await pdfControl.addField({
  pageNumber: 1, // 1-based page number
  rect: { x: 100, y: 100, width: 150, height: 50 },
  id: 'sign_1',
  type: 'signature', // or 'text', 'image', 'html'
  draggable: true,
  resizable: true
});

// 4. Listen to events
pdfControl.on('fields:change', (fields) => {
  console.log('Fields updated:', fields);
});

API

Document Loading

load(source: string | Uint8Array | ArrayBuffer): Promise<void>

Loads and renders the PDF from the given URL or buffer.

View Mode

setViewMode(mode: 'single' | 'scroll'): Promise<void>

Switches between single page view and continuous scroll view.

getViewMode(): ViewMode

Returns the current view mode.

Page Navigation

goToPage(page: number): void

Navigate to a specific page (1-based index).

getCurrentPage(): number

Get the current page number (1-based).

getTotalPages(): number

Get total number of pages in the document.

nextPage(): void

Navigate to the next page.

previousPage(): void

Navigate to the previous page.

getPageDimensions(pageNumber: number): Promise<{ width: number; height: number } | null>

Get dimensions of a specific page in PDF points (unscaled).

Parameters:

  • pageNumber: 1-based page number

Returns: Page dimensions { width, height } in PDF points, or null if the page doesn't exist.

Example:

const dims = await pdfControl.getPageDimensions(1); // First page
console.log(`Page dimensions: ${dims.width} x ${dims.height} points`);

Zoom

setScale(scale: number): void

Controls the zoom level of the document.

getScale(): number

Get the current zoom scale.

Field Management

addField(field: SignatureField): Promise<void>

Adds a new signature field to the document.

removeField(fieldId: string): void

Removes a field by its ID.

updateField(fieldId: string, updates: Partial<SignatureField>): void

Updates a field's properties.

getFields(): SignatureField[]

Returns the current list of fields.

clearFields(): void

Remove all fields from the document.

setFields(fields: SignatureField[]): void

Replace all fields with a new set.

Events

on(event: string, handler: Function): void

Subscribe to events:

  • page:change: Fired when page changes - (data: { page: number, total: number }) => void
  • scale:change: Fired when zoom changes - (data: { scale: number }) => void
  • field:add: Fired when a field is added - (field: SignatureField) => void
  • field:remove: Fired when a field is removed - (data: { fieldId: string }) => void
  • field:update: Fired when a field is updated - (data: { fieldId: string, updates: Partial<SignatureField> }) => void
  • fields:change: Fired when any field changes - (fields: SignatureField[]) => void
  • field:selection-change: Fired when selection changes - (data: { field: SignatureField | null }) => void

Printing

print(options?: { withSignatures?: boolean }): Promise<void>

Prints the current document. Default is printing without signatures.

License

MIT