@hhangular/pdfjs
hhangular/pdfjs
Full documentation available here :This library was generated with Angular CLI version 8.0.0.
You can read how here
This library contains an angular module PdfjsModule that contains a collection of components.
Components of PdfjsModule are implementation of mozilla pdfjs for angular 8x.
It contains some components for use easily the mozilla pdf viewer pdfjs.
dependencies
- pdfjs-dist
- @types/pdfjs-dist
Installation
npm install @hhangular/pdfjs --save
Configuration
Add assets pdfworker in angular.json
{
...
"projects": {
"YOUR PROJECT": {
...
"architect": {
"build": {
...
"options": {
...
"assets": [
{
"glob": "pdf.worker.js",
"input": "./node_modules/pdfjs-dist/build",
"output": "/assets"
},
...
In modules using pdfModule, import PdfjsModule and configure worker
@NgModule({
...
imports: [
BrowserModule,
SharedModule,
PdfjsBoxModule.config({workerSrc: 'assets/pdf.worker.js'})
],
...
bootstrap: [AppComponent]
})
export class AppModule {
}
The best way is use SharedModule and export PdfjsModule. Like this you have just to import SharedModule in others modules.
@NgModule({
imports: [
CommonModule,
PdfjsModule.forRoot({workerSrc: 'assets/pdf.worker.js'}),
],
exports: [
PdfjsModule,
],
declarations: [],
})
export class SharedModule {
}
Components
- pdfjs-thumbnails : Thumbnails of pdf
- pdfjs-view : A single page of pdf
Control
- PdfjsControl : Allow control pdf
- PdfjsGroupControl : Allow control multi PdfjsControl
objects
- PdfPage : Represents a pdf page serialisable, usefull for implement features on backend