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

@pdftron/webviewer-walkthrough

v1.0.6

Published

Module to show tool-tips demonstrating the functionality of WebViewer.

Downloads

447

Readme

WebViewer Walkthrough

WebViewer is a powerful JavaScript-based PDF Library that's part of the PDFTron PDF SDK. It allows you to view and annotate PDF files on your web app with a fully customizable UI.

This is an addon for WebViewer that allows you to create WebViewer Walkthroughs or step-by-step tutorials how to use WebViewer.

Initial setup

Before you begin, make sure your development environment includes Node.js and npm.

Install

npm install @pdftron/webviewer-walkthrough

How to use

Here is an example of how WebViewer and WebViewer-video could be integrated into your application.

import React, { useRef, useEffect } from 'react';
import WebViewer from '@pdftron/webviewer';
import { initializeWalkthrough } from '@pdftron/webviewer-walkthrough';

const App = () => {
  const viewer = useRef(null);

  useEffect(() => {
    WebViewer(
      {
        path: '/webviewer/lib',
        initialDoc: '/files/PDFTRON_about.pdf',
      },
      viewer.current
    ).then((instance) => {
      const { start, exit } = initializeWalkthrough(
        viewer.current,
        [
          {
            dataElement: 'leftPanelButton',
            header: 'Page Thumbnails',
            text: 'You can see all of the page thumbnails here.'
          },
          {
            dataElement: 'pageNavOverlay',
            text: 'Navigate pages'
          },
          {
            dataElement: 'toolbarGroup-Annotate',
            header: 'Annotate',
            text: 'In here you can find all the different tools you need to work with document.'
          },
          {
            dataElement: 'toggleNotesButton',
            text: 'Here you can see all of the comments on the document.'
          },
        ],
        () => {
          console.log('tutorial complete...');
        }
      );

      start();
    });
  }, []);

  return (
    <div className="App">
      <div className="webviewer" ref={viewer}></div>
    </div>
  );
};

export default App;

Customizing the appearance

You can customize the appearance of the card as well, by passing options object containing colors:

  const options = {
    focusColor: '#FA4E32',
    backgroundColor: '#FA4E32',
    headerColor: '#36110B',
    textColor: '#1F0D06',
    iconColor: '#fff'
  };
  const { start, exit } = initializeWalkthrough(
    // First 3 arguments
    options,
  );

  start();

Documentation

/**
 * Initializes the app walkthrough.
 * @static
 * @param {HTMLDivElement} viewerElement the element WebViewer is mounted on.
 * @param {Step[]} steps an array of objects that contains data-element and tip text top be shown
 * @param {Options} [options] customization options
 * @returns {WalkthroughFunctions} an object that contains functions to start the walkthrough and to finish it early.
 */

/**
 * @typedef {Object} WalkthroughFunctions
 * @property {function} start
 * Starts the walkthrough from the beginning.
 * @property {function} exit
 * You can exit the walkthrough before it is finished.
 */

/**
 * @typedef {Object} Step
 * @property {string} dataElement
 * data-element property of the element you want to focus on.
 * @property {string} [header]
 * Header text to display for this step.
 * @property {string} [text]
 * Text body to display for this step.
 */

/**
 * @typedef {Object} Options
 * @property {string} [focusColor]
 * Color for focus on the data-element for the step. Default is #9fdef9.
 * @property {string} [backgroundColor]
 * Background color for the step. Default is #9fdef9.
 * @property {string} [headerColor]
 * Header text color for the step. Default is #192c64.
 * @property {string} [textColor]
 * Text color for the step. Default is #2f546b.
 * @property {string} [iconColor]
 * Icon & step counter color for the step. Default is #334758.
 */

License

For more information on licensing, please visit our website.