Giter Site home page Giter Site logo

peter554 / ngx-pdfjs Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 2.36 MB

A simple component for viewing PDFs in an Angular application using PDF.js

Home Page: https://peter554.github.io/ngx-pdfjs/

License: MIT License

PowerShell 4.75% JavaScript 14.08% TypeScript 73.35% HTML 5.23% CSS 2.59%
pdfjs angular

ngx-pdfjs's Introduction

ngx-pdfjs

A simple component for viewing PDFs in an Angular application using PDF.js.

Usage

  • npm install pdfjs-dist

  • Add scripts to angular.json.

"scripts": [
    "node_modules/pdfjs-dist/build/pdf.min.js",
    "node_modules/pdfjs-dist/build/pdf.worker.min.js",
    ...
]
  • Copy all files from the PdfViewerModule into your project and import into your root AppModule.
import { PdfViewerModule } from './pdf-viewer/pdf-viewer.module';
...
imports: [..., PdfViewerModule],
  • Use the component.

e.g.

<!-- 'pdf' is some Blob we want to view -->
<div class="viewer-container">
  <app-pdf-viewer [src]="pdf" [quality]="2" width="90%" maxWidth="800px" spacerSize="0.5rem"></app-pdf-viewer>
</div>
.viewer-container {
  display: flex;
  justify-content: center;
  background-color: #eee;
}

See a demo here.

@Inputs

@Input Type Required Default Description
src string or Blob Yes '' The PDF source.
quality number No 2 A quality factor. Higher values will look better but render slower.
width string No '100%' The PDF width.
maxWidth string No '800px' The PDF max-width.
spacerSize string No '0' The amount of space between each page.

ngx-pdfjs's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.