2.7.0 • Published 6 years ago

pdf-viewer-st v2.7.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Built With Stencil

Hive PDF Viewer

This web component allows you to add PDF rendering support to your web applications.

Forked from: @teamhive/pdf-viewer.

Up to date 2.4.0.

This repository will only be active as long as the official component does not support these new features.

Features

  • Rendering PDFs on web (Angular, Ionic, React, Stencil, etc.)
  • Search
  • Fit to Page / Fit to Width
  • Side panel for quick thumbnail navigation
  • Text selection
  • Swipe events (left/right) to show/hide the side drawer
  • Pinch events (in/out) to performs zoom in/out in the document

Installation

  • npm i pdf-viewer-st

Usage

<hive-pdf-viewer src="http://www.mydomain.com/example.pdf"></hive-pdf-viewer>

Somewhere in your project (e.g. main.ts):

import { defineCustomElements } from 'pdf-viewer-st/dist/loader';
defineCustomElements(window);

Angular

Add viewer assets to angular.json assets block:

{
    "projects": {
        "app": {
            "architect": {
                "build": {
                    "options": {
                        "assets": [
                            {
                                "glob": "**/*",
                                "input": "node_modules/pdf-viewer-st/dist/pdf-viewer/pdf-viewer-assets",
                                "output": "pdf-viewer-assets"
                            }

Follow the Stencil JS Framework Integration guide for more info.

Properties

PropertyDefaultDescription
srcThe PDF web address location (http, https)
page1The default page index.
enableToolbartrueIf the toolbar is available for display.
enableSideDrawertrueIf the side drawer UI (and button) is available for display.
enableSearchtrueIf the document can be searched through. Hides the button when false.
disableScrollingfalseDisables scrolling in the document.
enableSwipetrueIf swipe events (left/right) are recognise to show/hide the side drawer.
enablePinchtrueIf pinch events (in/out) are recognise to performs zoom in/out.

Events

EventDescription
onLinkClick(href: string)Emits the href clicked when it's not an internal document annotation.
pageChange(currentPage: number)Emits the current page number when the current page changes.
selectedText(selection: Selection)Emits the current selection by user.

Contributors

Sean BanniganSean PerkinsJustin True
2.7.0

6 years ago

2.6.0

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago