ionic3 + angular5 view pdf

1.ng2-pdf-viewer

npm install ng2-pdf-viewer --save   // version 3.0.8 

introduced in app.module.ts
//PDF
import {PdfViewerModule} from 'ng2-pdf-viewer';
imports: [// here only the introduction of this module, other needs are introduced separately according to their module 
PdfViewerModule
]

introduced the use of ts page
{} PDFDocumentProxy Import from 'NG2-PDF-Viewer';

introduced in the corresponding page module.ts
import {PdfViewerModule} from 'ng2-pdf-viewer';
 
imports: [// introduced Ibid 
. IonicPageModule forChild (DataInquiryModalPage), PdfViewerModule
]

HTML
<pdf-viewer [src]="url"-->
[show-all]="true"
[original-size]="false"
[zoom]="num"
[render-text]="false"
[autoresize]="true"
style="display: block" >
<!--</pdf-viewer>
https://vadimdez.github.io/ng2-pdf-viewer/ 
https://www.npmjs.com/package/ng2-pdf-viewer
there is a lack of movement in the end, when multiple entry blank page, the current so far not resolved, so do not use this method

2.ngx-Extended-pdf-viewer

First on npm address

https://www.npmjs.com/package/ngx-extended-pdf-viewer

Here is a demo https://github.com/tanzl88/ionic-3-extended-pdf-viewer

This component does not require npm i, see the link to download the demo, demo based on the content of the page after finishing his own to change in accordance with the following

New Component G Ionic NGX-Extended-PDF Viewer-assembly

Because the components that you create in component.module.ts there is so introduced

Import {NgxExtendedPdfViewerComponent} from './ngx-extended-pdf-viewer/ ngx-Extended-pdf-viewer ';

Changed

import { NgxExtendedPdfViewerComponent } from './ngx-extended-pdf-viewer/ngx-extended-pdf-viewer.component';

Introduced in module.ts use of the page

 

import { ComponentsModule } from './../../components/components.module';
Imports: [ 
. IonicPageModule forChild (DataInquiryModalPage)
ComponentsModule
],

page using components
<ngx-extended-pdf-viewer [src]="url" [zoom]="num" [useBrowserLocale]="true"></ngx-extended-pdf-viewer>
 

 

 

Guess you like

Origin www.cnblogs.com/wei-dong/p/11332603.html