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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@accusoft/pdf-viewer

v3.11.158639

Published

Accusoft PDF Viewer

Downloads

941

Readme

Accusoft PDF Viewer

Accusoft PDF Viewer is a client-only JavaScript library which allows you to easily embed PDF viewing and annotation functionality to your website or web application.

Accusoft PDF Viewer Illustration

Live Demo

Click here for a live demo.

Pricing and Editions

The Standard edition includes basic viewing features and is free-to-use. The Professional edition includes paid functionality like annotations, white labeling, and eSignatures. Contact us for more information on pricing and editions.

Quick Start

Install @accusoft/pdf-viewer

npm install @accusoft/pdf-viewer

Create a container div

Define a container DOM element on your page where you want the viewer to exist:

<!-- NOTE: The viewer will only fill the size of your container.
       Make sure your container has a defined width and height! -->
<div id="myContainer" style="height: 800px;"></div>

For mobile, define a viewport meta tag

For mobile, define a viewport meta tag in the head of your HTML which ensures the viewport is kept the same size as the device screen:

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />

Import and create a viewer

Import PdfViewerControl and create a viewer:

import { PdfViewerControl } from '@accusoft/pdf-viewer';

(async () => {
  window.myViewer = await PdfViewerControl.create({
    container: document.getElementById('myContainer'),

    // URL or Uint8Array for a PDF
    sourceDocument: 'https://yourdomain.com/documents/example.pdf'
  });
})();

Optionally, use a licenseKey of 'eval' to evaluate Professional features, enabling the allowedControls you want, such as annotation tools:

(async () => {
  // Create a viewer
  window.myViewer = await PdfViewerControl.create({
    container: document.getElementById('myContainer'),

    // URL or Uint8Array for a PDF
    sourceDocument: 'https://yourdomain.com/documents/example.pdf',

    // Evaluate Professional features (page contents will be watermarked)
    licenseKey: 'eval',

    // Configure the UI:
    allowedControls: {
      // Enable or disable annotation tools (all false by default):
      ellipseTool: true,
      freehandDrawingTool: true,
      freehandSignatureTool: true,
      lineTool: true,
      rectangleTool: true,
      textHighlightTool: true,

      // Enable or disable other parts of the UI (all true by default):
      fullScreenToggle: true,
      nextAndPreviousPageButtons: true,
      pageNumberAndCount: true,
      printing: true,
      search: true,
      thumbnails: true,
      zoomInAndOutButtons: true
    }
  });
})();

Use a Script Tag Instead

As an alternative to import, you can also use PdfViewerControl via a script tag.

To do this, either:

  • Host the bundle.js included in the @accusoft/pdf-viewer npm package and load it in your page with a script tag:

    <script src="path/to/bundle.js"></script>
  • Reference the bundle.js file using a popular npm CDN, like jsdelivr.net:

    <script src="https://cdn.jsdelivr.net/npm/@accusoft/pdf-viewer@3/bundle.js"></script>

This will attach the viewer creation API to window so you can use it (window.Accusoft.PdfViewerControl).

Then, create the viewer:

<script>
  (async () => {
    // Create a viewer
    window.myViewer = await window.Accusoft.PdfViewerControl.create({
      container: document.getElementById('myContainer'),

      // URL or Uint8Array for a PDF
      sourceDocument: 'https://yourdomain.com/documents/example.pdf'
    });
  })();
</script>

Optionally, use a licenseKey of 'eval' to evaluate Professional features, enabling the allowedControls you want, such as annotation tools:

<script>
  (async () => {
    // Create a viewer
    window.myViewer = await window.Accusoft.PdfViewerControl.create({
      container: document.getElementById('myContainer'),

      // URL or Uint8Array for a PDF
      sourceDocument: 'https://yourdomain.com/documents/example.pdf',

      // Evaluate Professional features (page contents will be watermarked)
      licenseKey: 'eval',

      // Configure the UI:
      allowedControls: {
        // Enable or disable annotation tools (all false by default):
        ellipseTool: true,
        freehandDrawingTool: true,
        freehandSignatureTool: true,
        lineTool: true,
        rectangleTool: true,
        textHighlightTool: true,

        // Enable or disable other parts of the UI (all true by default):
        fullScreenToggle: true,
        nextAndPreviousPageButtons: true,
        pageNumberAndCount: true,
        printing: true,
        search: true,
        thumbnails: true,
        zoomInAndOutButtons: true
      }
    });
  })();
</script>

Samples

Documentation

For complete documentation, click here.

Feedback

Submit suggestions and feature requests to https://ideas.accusoft.com/

Report issues or bugs to https://issues.accusoft.com

Support Plans

Paid support is available:

  • For the free Standard edition, basic support is available for a charge.
  • For the paid Professional edition, support is included with an annual license. Additional levels of support are also available as an upgrade.

Contact us for more information about our support packages.

Questions

Email [email protected] or call 1-800-875-7009.