0.2.2 • Published 5 years ago

@teamhive/stencil-pdf-viewer v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Hive Stencil PDF Viewer

This web component allows you to add PDF rendering support to your web (and Ionic native) applications.

Features

  • Rendering PDFs on web (Angular, Ionic, React, Stencil, etc.)
  • Search
  • Rotation of Documents
  • Fit to Page / Fit to Width
  • Side panel for quick thumbnail navigation

Preview

MobileWeb
Mobile ImageWeb Image

Installation

  • npm i @teamhive/stencil-pdf-viewer

Usage

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

Angular (6+) / Ionic (4+)

In your angular.json file add the following assets matcher in your projects.app.architect.build.options.assets collection:

{
    "glob": "**/*",
    "input": "node_modules/@teamhive/stencil-pdf-viewer/dist/pdfviewer",
    "output": "./pdfviewer"
}

In your main AppModule (i.e. app.module.ts) add the following import statement:

import '@teamhive/stencil-pdf-viewer/dist/pdfviewer';

Properties

PropertyDefaultDescription
srcThe PDF web address location (file://httphttps)
page1The default page index.
zoom1The current zoom target for the document.
minZoom0.25The minimum zoom target allowed for the document.
maxZoom4The maximum zoom target allowed for the document.
rotation0The rotated document value.
allowPrintfalseIf the document allows printing (hides print button).
searchOpenfalseIf the search pop-up panel should be displayed by default.
enableSideDrawertrueIf the side drawer UI (and button) is available for display.
enableRotatetrueIf the document can be rotated. Hides the button when false.
enableSearchtrueIf the document can be searched through. Hides the button when false.

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.
afterLoadComplete(pdf: PDFDocumentProxy)Emits the pdf document when the loading task completes.
onError(error: any)Emitted when the document fails to load.
onProgress(progressData: PDFProgressData)Emit when the loading task returns back progress.

Contributors

Sean BanniganSean PerkinsJustin True