#68 PDFJS Mock and test

This commit is contained in:
Eugenio Romano
2016-05-31 14:48:30 +01:00
parent 0ccdd43842
commit c42d497618
7 changed files with 90 additions and 10 deletions

View File

@@ -41,9 +41,9 @@ export class ViewerComponent {
ngOnInit() {
console.log('urlFile ' + this.urlFile);
this.nameFile = PDFJS.getFilenameFromUrl(this.urlFile);
this.nameFile = this.getPDFJS().getFilenameFromUrl(this.urlFile);
PDFJS.getDocument(this.urlFile).then((pdf) => {
return this.getPDFJS().getDocument(this.urlFile).then((pdf) => {
this.currentPdf = pdf;
this.totalPages = pdf.numPages;
this.currentPage = 1;
@@ -52,6 +52,10 @@ export class ViewerComponent {
});
}
getPDFJS() {
return PDFJS;
}
loadPage(pdf: any, numberPage: number) {
pdf.getPage(numberPage).then((page) => {
@@ -59,7 +63,6 @@ export class ViewerComponent {
let scale = 1.5;
let viewport = page.getViewport(scale);
let canvas: any = document.getElementById('viewer-the-canvas');
if (canvas) {