1179 lines
41 KiB
JavaScript
1179 lines
41 KiB
JavaScript
import { Component, ElementRef, EventEmitter, Input, Output, NgModule } from '@angular/core';
|
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes} checked by tsc
|
|
*/
|
|
/** @enum {number} */
|
|
const SimpleSearchState = {
|
|
FOUND: 0,
|
|
NOT_FOUND: 1,
|
|
WRAPPED: 2,
|
|
PENDING: 3,
|
|
};
|
|
SimpleSearchState[SimpleSearchState.FOUND] = "FOUND";
|
|
SimpleSearchState[SimpleSearchState.NOT_FOUND] = "NOT_FOUND";
|
|
SimpleSearchState[SimpleSearchState.WRAPPED] = "WRAPPED";
|
|
SimpleSearchState[SimpleSearchState.PENDING] = "PENDING";
|
|
/**
|
|
* PDF Document basic information representation
|
|
*/
|
|
class SimpleDocumentInfo {
|
|
/**
|
|
* @param {?} key
|
|
* @param {?} value
|
|
*/
|
|
constructor(key, value) {
|
|
this.key = key;
|
|
this.value = value;
|
|
}
|
|
;
|
|
}
|
|
/**
|
|
* Representation of the Outline nodes
|
|
*/
|
|
class SimpleOutlineNode {
|
|
/**
|
|
* @param {?} title
|
|
* @param {?} dest
|
|
* @param {?} items
|
|
*/
|
|
constructor(title, dest, items) {
|
|
this.title = title;
|
|
this.dest = dest;
|
|
this.items = items;
|
|
}
|
|
;
|
|
}
|
|
/**
|
|
* Representation of the loading progress
|
|
*/
|
|
class SimpleProgressData {
|
|
/**
|
|
* @param {?} loaded
|
|
* @param {?} total
|
|
*/
|
|
constructor(loaded, total) {
|
|
this.loaded = loaded;
|
|
this.total = total;
|
|
}
|
|
;
|
|
}
|
|
/**
|
|
* Representation of the settings of the search
|
|
*/
|
|
class SimpleSearchOptions {
|
|
/**
|
|
* @param {?=} caseSensitive
|
|
* @param {?=} highlightAll
|
|
* @param {?=} phraseSearch
|
|
*/
|
|
constructor(caseSensitive = false, highlightAll = true, phraseSearch = true) {
|
|
this.caseSensitive = caseSensitive;
|
|
this.highlightAll = highlightAll;
|
|
this.phraseSearch = phraseSearch;
|
|
}
|
|
;
|
|
}
|
|
SimpleSearchOptions.DEFAULT_OPTIONS = new SimpleSearchOptions();
|
|
/**
|
|
* Representation of the PDF bookmark
|
|
*/
|
|
class SimplePDFBookmark {
|
|
/**
|
|
* @param {?=} page
|
|
* @param {?=} zoom
|
|
* @param {?=} rotation
|
|
* @param {?=} x
|
|
* @param {?=} y
|
|
*/
|
|
constructor(page = 1, zoom = 1, rotation = 0, x = 0, y = 0) {
|
|
this.page = page;
|
|
this.zoom = zoom;
|
|
this.rotation = rotation;
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
/**
|
|
* Build destination object to navigation
|
|
* @return {?}
|
|
*/
|
|
toDestination() {
|
|
return { pageNumber: this.page, destArray: [null, { name: 'XYZ' }, this.x, this.y, this.zoom] };
|
|
}
|
|
/**
|
|
* Build query string to URL
|
|
* @return {?}
|
|
*/
|
|
toQueryString() {
|
|
return `${SimplePDFBookmark.PARAMETER_SEPARATOR}` +
|
|
`${SimplePDFBookmark.PARAMETER_PAGE}=${this.page}${SimplePDFBookmark.PARAMETER_SEPARATOR}` +
|
|
`${SimplePDFBookmark.PARAMETER_ZOOM}=${this.zoom}${SimplePDFBookmark.PARAMETER_SEPARATOR}` +
|
|
`${SimplePDFBookmark.PARAMETER_ROTATION}=${this.rotation}${SimplePDFBookmark.PARAMETER_SEPARATOR}` +
|
|
`${SimplePDFBookmark.PARAMETER_X}=${this.x}${SimplePDFBookmark.PARAMETER_SEPARATOR}` +
|
|
`${SimplePDFBookmark.PARAMETER_Y}=${this.y}`;
|
|
}
|
|
/**
|
|
* Build bookmark obeject from src url
|
|
* @param {?} src
|
|
* @return {?}
|
|
*/
|
|
static buildSimplePDFBookmark(src) {
|
|
if (src && typeof src === 'string' && src.trim().length > 0) {
|
|
var /** @type {?} */ parts = src.split(SimplePDFBookmark.PARAMETER_SEPARATOR);
|
|
if (parts.length > 0) {
|
|
const /** @type {?} */ bookmark = new SimplePDFBookmark();
|
|
parts.forEach(part => {
|
|
const /** @type {?} */ parameters = part.split("=");
|
|
const /** @type {?} */ paramert_name = parameters[0];
|
|
if (parameters.length === 2 && bookmark.hasOwnProperty(paramert_name)) {
|
|
let /** @type {?} */ paramert_value = 0;
|
|
if (paramert_name === SimplePDFBookmark.PARAMETER_ZOOM) {
|
|
paramert_value = parseFloat(`${parameters[1]}`);
|
|
}
|
|
else {
|
|
paramert_value = parseInt(`${parameters[1]}`, 10);
|
|
}
|
|
paramert_value = Number.isNaN(paramert_value) ? 0 : paramert_value;
|
|
bookmark[paramert_name] = paramert_value;
|
|
}
|
|
});
|
|
return bookmark;
|
|
}
|
|
}
|
|
return SimplePDFBookmark.EMPTY_BOOKMARK;
|
|
}
|
|
}
|
|
SimplePDFBookmark.EMPTY_BOOKMARK = new SimplePDFBookmark(1, 0.75, 0, 0, 0);
|
|
SimplePDFBookmark.PARAMETER_SEPARATOR = '#';
|
|
SimplePDFBookmark.PARAMETER_PAGE = 'page';
|
|
SimplePDFBookmark.PARAMETER_ZOOM = 'zoom';
|
|
SimplePDFBookmark.PARAMETER_ROTATION = 'rotation';
|
|
SimplePDFBookmark.PARAMETER_X = 'x';
|
|
SimplePDFBookmark.PARAMETER_Y = 'y';
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes} checked by tsc
|
|
*/
|
|
/** @enum {number} */
|
|
const ScalePriority = {
|
|
FULL: 0,
|
|
WIDTH: 1,
|
|
HEIGHT: 2,
|
|
};
|
|
ScalePriority[ScalePriority.FULL] = "FULL";
|
|
ScalePriority[ScalePriority.WIDTH] = "WIDTH";
|
|
ScalePriority[ScalePriority.HEIGHT] = "HEIGHT";
|
|
if (typeof window !== 'undefined') {
|
|
window['pdfjs-dist/build/pdf'] = require('pdfjs-dist/build/pdf');
|
|
require('pdfjs-dist/web/compatibility');
|
|
require('pdfjs-dist/web/pdf_viewer');
|
|
PDFJS.verbosity = (/** @type {?} */ (PDFJS)).VERBOSITY_LEVELS.errors;
|
|
}
|
|
/**
|
|
* Simple PDF Viewer component
|
|
*/
|
|
class SimplePdfViewerComponent {
|
|
/**
|
|
* @param {?} element
|
|
* @param {?} http
|
|
*/
|
|
constructor(element, http) {
|
|
this.element = element;
|
|
this.http = http;
|
|
/**
|
|
* Page border is displayed or not (Optional)
|
|
*/
|
|
this.removePageBorders = false;
|
|
/**
|
|
* Text layer is displayed or not (Optional)
|
|
*/
|
|
this.disableTextLayer = false;
|
|
this.onLoadComplete = new EventEmitter();
|
|
this.onError = new EventEmitter();
|
|
this.onProgress = new EventEmitter();
|
|
this.onSearchStateChange = new EventEmitter();
|
|
this.startAt = SimplePDFBookmark.EMPTY_BOOKMARK;
|
|
this.loaded = false;
|
|
this.currentPage = 1;
|
|
this.numberOfPages = 1;
|
|
this.outline = [];
|
|
this.zoom = 1.0;
|
|
this.rotation = 0;
|
|
this.searching = false;
|
|
this.lastSearchText = '';
|
|
this.searchPrevious = false;
|
|
this.searchOptions = SimpleSearchOptions.DEFAULT_OPTIONS;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
ngOnInit() {
|
|
if (typeof window !== 'undefined') {
|
|
if (typeof PDFJS.workerSrc !== 'string') {
|
|
const /** @type {?} */ workerUrl = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${((/** @type {?} */ (PDFJS))).version}/pdf.worker.min.js`;
|
|
PDFJS.workerSrc = workerUrl;
|
|
}
|
|
this.initPDFJS();
|
|
this.openDocument(this.src);
|
|
}
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
ngOnDestroy() {
|
|
if (this.pdf) {
|
|
this.pdf.destroy();
|
|
}
|
|
}
|
|
/**
|
|
* Open a PDF document at the specified page (at the first page by default)
|
|
* @param {?} src Source of the PDF document
|
|
* @param {?=} startAt The bookmark where should start, default: at the first page
|
|
* @return {?}
|
|
*/
|
|
openDocument(src, startAt = SimplePDFBookmark.EMPTY_BOOKMARK) {
|
|
this.resetParameters();
|
|
this.startAt = startAt;
|
|
this.setAndParseSrc(src);
|
|
this.loadFile();
|
|
}
|
|
/**
|
|
* Open a PDF document at the specified page (at the first page by default)
|
|
* @param {?} file The File source of the PDF document
|
|
* @param {?=} startAt The bookmark where should start, default: at the first page
|
|
* @return {?}
|
|
*/
|
|
openFile(file, startAt = SimplePDFBookmark.EMPTY_BOOKMARK) {
|
|
try {
|
|
const /** @type {?} */ fileReader = new FileReader();
|
|
fileReader.onload = () => {
|
|
this.openDocument(new Uint8Array(fileReader.result), startAt);
|
|
};
|
|
fileReader.onerror = (error) => {
|
|
this.onError.emit(error);
|
|
this.loaded = false;
|
|
};
|
|
fileReader.readAsArrayBuffer(file);
|
|
}
|
|
catch (/** @type {?} */ error) {
|
|
this.onError.emit(error);
|
|
this.loaded = false;
|
|
}
|
|
}
|
|
/**
|
|
* Open a PDF document at the specified page (at the first page by default)
|
|
* @param {?} url The url of the PDF document
|
|
* @param {?=} startAt The bookmark where should start, default: at the first page
|
|
* @return {?}
|
|
*/
|
|
openUrl(url, startAt = SimplePDFBookmark.EMPTY_BOOKMARK) {
|
|
this.http.get(url, { responseType: 'arraybuffer' })
|
|
.subscribe((file) => {
|
|
this.openDocument(new Uint8Array(file), startAt);
|
|
}, error => {
|
|
this.onError.emit(error);
|
|
this.loaded = false;
|
|
});
|
|
}
|
|
/**
|
|
* Returns whether the PDF document is loaded properly
|
|
* @return {?}
|
|
*/
|
|
isDocumentLoaded() {
|
|
return this.loaded;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
initPDFJS() {
|
|
const /** @type {?} */ container = this.getContainer();
|
|
(/** @type {?} */ (PDFJS)).disableTextLayer = this.disableTextLayer;
|
|
this.pdfLinkService = new (/** @type {?} */ (PDFJS)).PDFLinkService();
|
|
this.pdfViewer = new (/** @type {?} */ (PDFJS)).PDFSinglePageViewer({
|
|
container: container,
|
|
removePageBorders: this.removePageBorders,
|
|
linkService: this.pdfLinkService,
|
|
});
|
|
this.pdfLinkService.setViewer(this.pdfViewer);
|
|
this.pdfFindController = new (/** @type {?} */ (PDFJS)).PDFFindController({
|
|
pdfViewer: this.pdfViewer
|
|
});
|
|
this.pdfViewer.setFindController(this.pdfFindController);
|
|
container.addEventListener('pagesinit', this.pagesinitEventListener.bind(this));
|
|
container.addEventListener('pagechange', this.pagechangeEventListener.bind(this));
|
|
container.addEventListener('updateviewarea', this.updateviewareaEventListener.bind(this));
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
pagesinitEventListener() {
|
|
this.pdfViewer.currentScaleValue = SimplePdfViewerComponent.PDF_VIEWER_DEFAULT_SCALE;
|
|
this.navigateToBookmark(this.startAt);
|
|
this.onLoadComplete.emit();
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
pagechangeEventListener() {
|
|
this.currentPage = this.pdfViewer._currentPageNumber;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
updateviewareaEventListener() {
|
|
this.zoom = this.pdfViewer._currentScale;
|
|
}
|
|
/**
|
|
* @param {?} src
|
|
* @return {?}
|
|
*/
|
|
setAndParseSrc(src) {
|
|
this.src = src;
|
|
if (this.src && typeof this.src === 'string') {
|
|
const /** @type {?} */ parts = this.src.split(SimplePDFBookmark.PARAMETER_SEPARATOR);
|
|
if (parts.length > 1) {
|
|
this.startAt = SimplePDFBookmark.buildSimplePDFBookmark(this.src);
|
|
this.src = parts[0];
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
loadFile() {
|
|
this.loaded = false;
|
|
if (this.src) {
|
|
if (this.pdf) {
|
|
this.pdf.destroy();
|
|
}
|
|
let /** @type {?} */ progressSrc;
|
|
if (typeof this.src === 'string') {
|
|
progressSrc = PDFJS.getDocument(/** @type {?} */ ({ url: this.src, withCredentials: true }));
|
|
}
|
|
else {
|
|
progressSrc = PDFJS.getDocument(/** @type {?} */ (this.src));
|
|
}
|
|
// progress
|
|
progressSrc.onProgress = (progressData) => {
|
|
this.onProgress.emit(new SimpleProgressData(progressData.loaded, progressData.total));
|
|
};
|
|
// loaded
|
|
(/** @type {?} */ (progressSrc.promise)).then(pdfDocument => {
|
|
this.pdfViewer.setDocument(pdfDocument);
|
|
this.pdfViewer.currentScaleValue = SimplePdfViewerComponent.PDF_VIEWER_DEFAULT_SCALE;
|
|
this.pdfLinkService.setDocument(pdfDocument, null);
|
|
this.pdf = pdfDocument;
|
|
this.pdf.getOutline().then((nodes) => {
|
|
this.outline = this.mapOutline(nodes);
|
|
});
|
|
this.pdf.getMetadata().then(information => {
|
|
Object.getOwnPropertyNames(information.info).forEach(key => {
|
|
this.information.push(new SimpleDocumentInfo(key, information.info[key]));
|
|
});
|
|
// Meta: info.metadata
|
|
});
|
|
this.numberOfPages = this.pdf.numPages;
|
|
this.loaded = true;
|
|
}, (error) => {
|
|
this.resetParameters();
|
|
this.onError.emit(error);
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
resetParameters() {
|
|
this.information = [];
|
|
this.outline = null;
|
|
this.currentPage = 1;
|
|
this.zoom = 1;
|
|
this.numberOfPages = 1;
|
|
this.startAt = SimplePDFBookmark.EMPTY_BOOKMARK;
|
|
if (this.pdfFindController) {
|
|
this.pdfFindController.reset();
|
|
}
|
|
}
|
|
/**
|
|
* @param {?} nodes
|
|
* @return {?}
|
|
*/
|
|
mapOutline(nodes) {
|
|
return nodes ? nodes.map(node => new SimpleOutlineNode(node.title, node.dest, this.mapOutline(node.items)), this) : [];
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
getContainer() {
|
|
return /** @type {?} */ (this.element.nativeElement.querySelector('div'));
|
|
}
|
|
/**
|
|
* Returns the basic information about the PDF document
|
|
* @return {?}
|
|
*/
|
|
getDocumentInformation() {
|
|
return this.loaded && !!this.information ? this.information : [];
|
|
}
|
|
/**
|
|
* Returns the value of the viewport scale
|
|
* @return {?}
|
|
*/
|
|
getZoom() {
|
|
return this.zoom;
|
|
}
|
|
/**
|
|
* Returns the value of the viewport scale in %
|
|
* @return {?}
|
|
*/
|
|
getZoomPercent() {
|
|
return Math.floor(this.getZoom() * 1000) / 10;
|
|
}
|
|
/**
|
|
* Increases the scale of the PDF viewport
|
|
* @return {?}
|
|
*/
|
|
zoomIn() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.setZoom(this.zoom + SimplePdfViewerComponent.ZOOM_UNIT);
|
|
}
|
|
}
|
|
/**
|
|
* Decreases the scale of the PDF viewport
|
|
* @return {?}
|
|
*/
|
|
zoomOut() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.setZoom(this.zoom - SimplePdfViewerComponent.ZOOM_UNIT);
|
|
}
|
|
}
|
|
/**
|
|
* Sets the original viewport scale back to 1.0
|
|
* @return {?}
|
|
*/
|
|
zoomReset() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.setZoom(1.0);
|
|
}
|
|
}
|
|
/**
|
|
* Sets the scale of the PDF viewport to fit in the actual screen
|
|
* @return {?}
|
|
*/
|
|
zoomFullPage() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.pdf.getPage(this.currentPage).then((page) => {
|
|
const /** @type {?} */ scale = this.getScale(page, ScalePriority.FULL);
|
|
this.setZoom(scale);
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* Sets the scale of the PDF viewport to fit in the actual screen (width priority)
|
|
* @return {?}
|
|
*/
|
|
zoomPageWidth() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.pdf.getPage(this.currentPage).then((page) => {
|
|
const /** @type {?} */ scale = this.getScale(page, ScalePriority.WIDTH);
|
|
this.setZoom(scale);
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* Sets the scale of the PDF viewport to fit in the actual screen (height priority)
|
|
* @return {?}
|
|
*/
|
|
zoomPageHeight() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.pdf.getPage(this.currentPage).then((page) => {
|
|
const /** @type {?} */ scale = this.getScale(page, ScalePriority.HEIGHT);
|
|
this.setZoom(scale);
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* @param {?} page
|
|
* @param {?=} priority
|
|
* @return {?}
|
|
*/
|
|
getScale(page, priority = ScalePriority.FULL) {
|
|
const /** @type {?} */ viewport = page.getViewport(1, this.rotation);
|
|
const /** @type {?} */ offsetHeight = this.getContainer().offsetHeight;
|
|
const /** @type {?} */ offsetWidth = this.getContainer().offsetWidth;
|
|
if (offsetHeight === 0 || offsetWidth === 0) {
|
|
return 1;
|
|
}
|
|
const /** @type {?} */ heightRatio = (offsetHeight - SimplePdfViewerComponent.PAGE_RESIZE_BORDER_HEIGHT) / viewport.height;
|
|
const /** @type {?} */ widthRatio = (offsetWidth - SimplePdfViewerComponent.PAGE_RESIZE_BORDER_WIDTH) / viewport.width;
|
|
let /** @type {?} */ ratio = heightRatio < widthRatio ? heightRatio : widthRatio;
|
|
if (priority !== ScalePriority.FULL) {
|
|
ratio = priority === ScalePriority.WIDTH ? widthRatio : heightRatio;
|
|
}
|
|
const /** @type {?} */ zoom = 1;
|
|
return Math.floor(zoom * ratio / SimplePdfViewerComponent.CSS_UNITS * 100) / 100;
|
|
}
|
|
/**
|
|
* Set the zoom of the document in double
|
|
* @param {?} scale The zoom value in double
|
|
* @return {?}
|
|
*/
|
|
setZoom(scale) {
|
|
if (this.isDocumentLoaded() && typeof scale === 'number') {
|
|
const /** @type {?} */ normalizedScale = this.normalizeScale(scale);
|
|
this.pdfViewer._setScale(normalizedScale, false);
|
|
this.zoom = normalizedScale;
|
|
}
|
|
}
|
|
/**
|
|
* Set the zoom of the document in percent
|
|
* @param {?} zoom The scale value in percent
|
|
* @return {?}
|
|
*/
|
|
setZoomInPercent(zoom) {
|
|
if (this.isDocumentLoaded() && typeof zoom === 'number') {
|
|
this.setZoom(zoom / 100);
|
|
}
|
|
}
|
|
/**
|
|
* @param {?} scale
|
|
* @return {?}
|
|
*/
|
|
normalizeScale(scale) {
|
|
let /** @type {?} */ normalizedScale = Math.round(scale * 1000) / 1000;
|
|
if (scale > SimplePdfViewerComponent.MAX_ZOOM) {
|
|
normalizedScale = SimplePdfViewerComponent.MAX_ZOOM;
|
|
}
|
|
else if (scale < SimplePdfViewerComponent.MIN_ZOOM) {
|
|
normalizedScale = SimplePdfViewerComponent.MIN_ZOOM;
|
|
}
|
|
return normalizedScale;
|
|
}
|
|
/**
|
|
* Starts case sensitive/insensitive text search and navigate to the first match (from the actual page)
|
|
* @param {?} text searched text
|
|
* @param {?=} searchOptions set true to use case sensitive searching (false by default)
|
|
* @return {?}
|
|
*/
|
|
search(text, searchOptions = SimpleSearchOptions.DEFAULT_OPTIONS) {
|
|
if (this.isDocumentLoaded()) {
|
|
const /** @type {?} */ searchText = text ? text.trim() : '';
|
|
if (!searchText) {
|
|
return;
|
|
}
|
|
this.lastSearchText = text;
|
|
this.searchPrevious = false;
|
|
this.searchOptions = searchOptions;
|
|
this.pdfFindController.onUpdateResultsCount = this.onUpdateResultsCount.bind(this);
|
|
this.pdfFindController.onUpdateState = this.onUpdateState.bind(this);
|
|
this.pdfFindController.executeCommand(SimplePdfViewerComponent.PDF_FINDER_FIND_COMMAND, {
|
|
caseSensitive: this.searchOptions.caseSensitive,
|
|
findPrevious: false,
|
|
highlightAll: this.searchOptions.highlightAll,
|
|
phraseSearch: this.searchOptions.phraseSearch,
|
|
query: searchText
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* Navigates to the next search match if there were multiple hits
|
|
* @return {?}
|
|
*/
|
|
nextMatch() {
|
|
this.stepMatch(false);
|
|
}
|
|
/**
|
|
* Navigates to the previous search match if there were multiple hits
|
|
* @return {?}
|
|
*/
|
|
previousMatch() {
|
|
this.stepMatch(true);
|
|
}
|
|
/**
|
|
* @param {?} findPrevious
|
|
* @return {?}
|
|
*/
|
|
stepMatch(findPrevious) {
|
|
if (this.isDocumentLoaded() && this.getNumberOfMatches() > 1) {
|
|
if (this.searchPrevious !== findPrevious) {
|
|
this.searchPrevious = findPrevious;
|
|
this.searchAgain();
|
|
}
|
|
else {
|
|
this.pdfFindController.nextMatch();
|
|
this.currentPage = this.pdfViewer._currentPageNumber;
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
searchAgain() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.pdfFindController.executeCommand(SimplePdfViewerComponent.PDF_FINDER_AGAIN_COMMAND, {
|
|
caseSensitive: this.searchOptions.caseSensitive,
|
|
findPrevious: this.searchPrevious,
|
|
highlightAll: this.searchOptions.highlightAll,
|
|
phraseSearch: this.searchOptions.phraseSearch,
|
|
query: this.lastSearchText
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* Returns the number of the search hits
|
|
* @return {?}
|
|
*/
|
|
getNumberOfMatches() {
|
|
if (this.isDocumentLoaded()) {
|
|
return this.pdfFindController.matchCount;
|
|
}
|
|
return 0;
|
|
}
|
|
/**
|
|
* Returns whether there is a matched item
|
|
* @return {?}
|
|
*/
|
|
hasMatches() {
|
|
return this.getNumberOfMatches() > 0;
|
|
}
|
|
/**
|
|
* Returns whether the search is in-progress
|
|
* @return {?}
|
|
*/
|
|
isSearching() {
|
|
return this.searching;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
onUpdateResultsCount() {
|
|
this.pdfFindController.onUpdateResultsCount = null;
|
|
this.currentPage = this.pdfViewer._currentPageNumber;
|
|
}
|
|
/**
|
|
* @param {?} state
|
|
* @return {?}
|
|
*/
|
|
onUpdateState(state) {
|
|
this.onSearchStateChange.emit(state);
|
|
this.searching = state === SimpleSearchState.PENDING;
|
|
if (!this.searching) {
|
|
this.pdfFindController.onUpdateState = null;
|
|
}
|
|
}
|
|
/**
|
|
* Returns the number of the actual page
|
|
* @return {?}
|
|
*/
|
|
getCurrentPage() {
|
|
return this.currentPage;
|
|
}
|
|
/**
|
|
* Returns the number of the pages
|
|
* @return {?}
|
|
*/
|
|
getNumberOfPages() {
|
|
return this.numberOfPages;
|
|
}
|
|
/**
|
|
* Returns outline / table of content in tree structure
|
|
* @return {?}
|
|
*/
|
|
getOutline() {
|
|
return this.hasOutline() ? this.outline : [];
|
|
}
|
|
/**
|
|
* Returns whether the outline is available
|
|
* @return {?}
|
|
*/
|
|
hasOutline() {
|
|
return this.loaded && !!this.outline && !!this.outline.length;
|
|
}
|
|
/**
|
|
* Navigates to the specified (outline) destination/chapter
|
|
* @param {?} destination the destination object of the outline item
|
|
* @return {?}
|
|
*/
|
|
navigateToChapter(destination) {
|
|
if (this.isDocumentLoaded()) {
|
|
// TODO: input validation
|
|
this.pdfLinkService.navigateTo(destination);
|
|
}
|
|
}
|
|
/**
|
|
* Navigates to the first page
|
|
* @return {?}
|
|
*/
|
|
firstPage() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.currentPage = 1;
|
|
this.navigateToPage(this.currentPage);
|
|
}
|
|
}
|
|
/**
|
|
* Navigates to the last page
|
|
* @return {?}
|
|
*/
|
|
lastPage() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.currentPage = this.getNumberOfPages();
|
|
this.navigateToPage(this.currentPage);
|
|
}
|
|
}
|
|
/**
|
|
* Navigates to the next page
|
|
* @return {?}
|
|
*/
|
|
nextPage() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.currentPage++;
|
|
this.navigateToPage(this.currentPage, 1);
|
|
}
|
|
}
|
|
/**
|
|
* Navigates to the previous page
|
|
* @return {?}
|
|
*/
|
|
prevPage() {
|
|
if (this.isDocumentLoaded()) {
|
|
this.currentPage--;
|
|
this.navigateToPage(this.currentPage, this.numberOfPages);
|
|
}
|
|
}
|
|
/**
|
|
* Navigates to the specified page
|
|
* @param {?} page the number of the page
|
|
* @param {?=} pageDefault
|
|
* @return {?}
|
|
*/
|
|
navigateToPage(page, pageDefault) {
|
|
if (this.isDocumentLoaded()) {
|
|
const /** @type {?} */ pageInt = parseInt(`${page}`, 10);
|
|
this.currentPage = pageInt ? pageInt : this.currentPage;
|
|
if (this.currentPage > this.numberOfPages) {
|
|
this.currentPage = pageDefault ? pageDefault : this.numberOfPages;
|
|
}
|
|
if (this.currentPage <= 0) {
|
|
this.currentPage = pageDefault ? pageDefault : 1;
|
|
}
|
|
this.pdfViewer.scrollPageIntoView({
|
|
pageNumber: this.currentPage
|
|
});
|
|
}
|
|
}
|
|
/**
|
|
* Sets the rotation to the default 0 degree
|
|
* @return {?}
|
|
*/
|
|
resetRotation() {
|
|
this.rotate(0);
|
|
}
|
|
/**
|
|
* Turns left the document with 90 degree (counterclockwise)
|
|
* @return {?}
|
|
*/
|
|
turnLeft() {
|
|
this.rotate(this.rotation - 90);
|
|
}
|
|
/**
|
|
* Turns right the document with 90 degree (clockwise)
|
|
* @return {?}
|
|
*/
|
|
turnRight() {
|
|
this.rotate(this.rotation + 90);
|
|
}
|
|
/**
|
|
* Returns the actual rotation value in degree
|
|
* @return {?}
|
|
*/
|
|
getRotation() {
|
|
return this.rotation;
|
|
}
|
|
/**
|
|
* @param {?=} angle
|
|
* @return {?}
|
|
*/
|
|
rotate(angle = 90) {
|
|
if (this.isDocumentLoaded()) {
|
|
this.rotation = parseInt(`${angle}`, 10);
|
|
if (this.rotation === 270) {
|
|
this.rotation = -90;
|
|
}
|
|
else if (this.rotation === -180) {
|
|
this.rotation = 180;
|
|
}
|
|
this.pdfViewer.pagesRotation = this.rotation;
|
|
}
|
|
}
|
|
/**
|
|
* Creates bookmark object based on the current viewport and page number.
|
|
* The object can be passed to the #navigateToBookmark method.
|
|
* @return {?}
|
|
*/
|
|
createBookmark() {
|
|
if (!this.isDocumentLoaded()) {
|
|
return Promise.reject('Document is not loaded');
|
|
}
|
|
const /** @type {?} */ pagePromise = /** @type {?} */ (/** @type {?} */ (this.pdf.getPage(this.currentPage)));
|
|
return pagePromise.then((page) => {
|
|
const /** @type {?} */ viewport = page.getViewport(1, this.rotation);
|
|
const /** @type {?} */ container = this.getContainer();
|
|
let /** @type {?} */ x = container.scrollLeft / container.scrollWidth * viewport.width;
|
|
let /** @type {?} */ y = (container.scrollHeight - container.scrollTop) / container.scrollHeight * viewport.height;
|
|
if (this.rotation === 90) {
|
|
y = container.scrollTop / container.scrollHeight * viewport.height;
|
|
let /** @type {?} */ tmp = x;
|
|
x = y;
|
|
y = tmp;
|
|
}
|
|
else if (this.rotation === 180) {
|
|
x = (container.scrollWidth - container.scrollLeft) / container.scrollWidth * viewport.width;
|
|
y = container.scrollTop / container.scrollHeight * viewport.height;
|
|
}
|
|
else if (this.rotation === -90) {
|
|
x = (container.scrollWidth - container.scrollLeft) / container.scrollWidth * viewport.width;
|
|
let /** @type {?} */ tmp = x;
|
|
x = y;
|
|
y = tmp;
|
|
}
|
|
x = Math.round(x);
|
|
y = Math.round(y);
|
|
return new SimplePDFBookmark(this.currentPage, this.zoom, this.rotation, x, y);
|
|
});
|
|
}
|
|
/**
|
|
* Navigates to the specified bookmark
|
|
* @param {?} bookmark
|
|
* @return {?}
|
|
*/
|
|
navigateToBookmark(bookmark) {
|
|
if (this.isDocumentLoaded() && !!bookmark) {
|
|
this.rotate(bookmark.rotation);
|
|
this.pdfViewer.scrollPageIntoView(bookmark.toDestination());
|
|
}
|
|
}
|
|
/**
|
|
* Create a snapshot image (PNG) based about the current page
|
|
* @param {?=} scale the value of the viewport scale, it is 1 by default
|
|
* @return {?}
|
|
*/
|
|
getPageSnapshot(scale = 1) {
|
|
if (this.isDocumentLoaded()) {
|
|
const /** @type {?} */ pagePromise = /** @type {?} */ (/** @type {?} */ (this.pdf.getPage(this.currentPage)));
|
|
return pagePromise.then((page) => {
|
|
const /** @type {?} */ viewport = page.getViewport(scale, 0);
|
|
const /** @type {?} */ canvas = /** @type {?} */ (/** @type {?} */ (document.createElement('canvas')));
|
|
const /** @type {?} */ context = canvas.getContext('2d');
|
|
canvas.height = viewport.height;
|
|
canvas.width = viewport.width;
|
|
const /** @type {?} */ task = /** @type {?} */ (/** @type {?} */ (page.render({ canvasContext: context, viewport: viewport })));
|
|
return task.then(() => this.dataURItoFile(canvas.toDataURL(SimplePdfViewerComponent.SNAPSHOT_TPYE)));
|
|
});
|
|
}
|
|
return Promise.reject('Document is not loaded');
|
|
}
|
|
/**
|
|
* @param {?} dataURI
|
|
* @return {?}
|
|
*/
|
|
dataURItoFile(dataURI) {
|
|
let /** @type {?} */ byteString;
|
|
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
|
|
byteString = atob(dataURI.split(',')[1]);
|
|
}
|
|
else {
|
|
byteString = unescape(dataURI.split(',')[1]);
|
|
}
|
|
const /** @type {?} */ mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
|
const /** @type {?} */ ia = new Uint8Array(byteString.length);
|
|
for (let /** @type {?} */ i = 0; i < byteString.length; i++) {
|
|
ia[i] = byteString.charCodeAt(i);
|
|
}
|
|
const /** @type {?} */ blob = new Blob([ia], { type: mimeString });
|
|
const /** @type {?} */ b = blob;
|
|
b.lastModifiedDate = new Date();
|
|
b.name = 'screen.png';
|
|
return /** @type {?} */ (blob);
|
|
}
|
|
}
|
|
SimplePdfViewerComponent.CSS_UNITS = 96.0 / 72.0;
|
|
SimplePdfViewerComponent.PAGE_RESIZE_BORDER_HEIGHT = 15;
|
|
SimplePdfViewerComponent.PAGE_RESIZE_BORDER_WIDTH = 15;
|
|
SimplePdfViewerComponent.ZOOM_UNIT = 0.1;
|
|
SimplePdfViewerComponent.MAX_ZOOM = 5;
|
|
SimplePdfViewerComponent.MIN_ZOOM = 0.05;
|
|
SimplePdfViewerComponent.PDF_FINDER_FIND_COMMAND = 'find';
|
|
SimplePdfViewerComponent.PDF_FINDER_AGAIN_COMMAND = 'findagain';
|
|
SimplePdfViewerComponent.PDF_VIEWER_DEFAULT_SCALE = 'page-fit';
|
|
SimplePdfViewerComponent.SNAPSHOT_TPYE = 'image/png';
|
|
SimplePdfViewerComponent.decorators = [
|
|
{ type: Component, args: [{
|
|
selector: 'simple-pdf-viewer',
|
|
template: `<div class="pdfViewerContainer" [hidden]="!isDocumentLoaded()"><div class="pdfViewer"></div></div>`,
|
|
styles: [`
|
|
:host /deep/ .pdfViewerContainer {
|
|
overflow: auto;
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
:host /deep/ .textLayer {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
overflow: hidden;
|
|
opacity: 0.2;
|
|
line-height: 1.0;
|
|
}
|
|
:host /deep/ .textLayer > div {
|
|
color: transparent;
|
|
position: absolute;
|
|
white-space: pre;
|
|
cursor: text;
|
|
-webkit-transform-origin: 0% 0%;
|
|
-moz-transform-origin: 0% 0%;
|
|
-o-transform-origin: 0% 0%;
|
|
-ms-transform-origin: 0% 0%;
|
|
transform-origin: 0% 0%;
|
|
}
|
|
:host /deep/ .textLayer .highlight {
|
|
margin: -1px;
|
|
padding: 1px;
|
|
background-color: #002bff;
|
|
border-radius: 4px;
|
|
}
|
|
:host /deep/ .textLayer .highlight.begin {
|
|
border-radius: 4px 0px 0px 4px;
|
|
}
|
|
:host /deep/ .textLayer .highlight.end {
|
|
border-radius: 0px 4px 4px 0px;
|
|
}
|
|
:host /deep/ .textLayer .highlight.middle {
|
|
border-radius: 0px;
|
|
}
|
|
:host /deep/ .textLayer .highlight.selected {
|
|
background-color: rgb(0, 100, 0);
|
|
}
|
|
:host /deep/ .textLayer ::selection { background: #002bff; }
|
|
:host /deep/ .textLayer ::-moz-selection { background: #002bff; }
|
|
:host /deep/ .textLayer .endOfContent {
|
|
display: block;
|
|
position: absolute;
|
|
left: 0px;
|
|
top: 100%;
|
|
right: 0px;
|
|
bottom: 0px;
|
|
z-index: -1;
|
|
cursor: default;
|
|
-webkit-user-select: none;
|
|
-ms-user-select: none;
|
|
-moz-user-select: none;
|
|
}
|
|
:host /deep/ .annotationLayer section {
|
|
position: absolute;
|
|
}
|
|
:host /deep/ .textLayer .endOfContent.active {
|
|
top: 0px;
|
|
}
|
|
:host /deep/ .annotationLayer .linkAnnotation > a {
|
|
position: absolute;
|
|
font-size: 1em;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
:host /deep/ .annotationLayer .linkAnnotation > a:hover {
|
|
opacity: 0.2;
|
|
background: #002bff;
|
|
box-shadow: 0px 2px 10px #002bff;
|
|
}
|
|
:host /deep/ .annotationLayer .linkAnnotation > a /* -ms-a */ {
|
|
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 repeat;
|
|
}
|
|
:host /deep/ .annotationLayer .textAnnotation img {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation input,
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation textarea,
|
|
:host /deep/ .annotationLayer .choiceWidgetAnnotation select,
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.checkBox input,
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.radioButton input {
|
|
background-color: #002bff;
|
|
border: 1px solid transparent;
|
|
box-sizing: border-box;
|
|
font-size: 9px;
|
|
height: 100%;
|
|
padding: 0 3px;
|
|
vertical-align: top;
|
|
width: 100%;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation textarea {
|
|
font: message-box;
|
|
font-size: 9px;
|
|
resize: none;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation input[disabled],
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation textarea[disabled],
|
|
:host /deep/ .annotationLayer .choiceWidgetAnnotation select[disabled],
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.checkBox input[disabled],
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.radioButton input[disabled] {
|
|
background: none;
|
|
border: 1px solid transparent;
|
|
cursor: not-allowed;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation input:hover,
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation textarea:hover,
|
|
:host /deep/ .annotationLayer .choiceWidgetAnnotation select:hover,
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.checkBox input:hover,
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.radioButton input:hover {
|
|
border: 1px solid #000;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation input:focus,
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation textarea:focus,
|
|
:host /deep/ .annotationLayer .choiceWidgetAnnotation select:focus {
|
|
background: none;
|
|
border: 1px solid transparent;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation input.comb {
|
|
font-family: monospace;
|
|
padding-left: 2px;
|
|
padding-right: 0;
|
|
}
|
|
:host /deep/ .annotationLayer .textWidgetAnnotation input.comb:focus {
|
|
width: 115%;
|
|
}
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.checkBox input,
|
|
:host /deep/ .annotationLayer .buttonWidgetAnnotation.radioButton input {
|
|
-webkit-appearance: none;
|
|
-moz-appearance: none;
|
|
-ms-appearance: none;
|
|
appearance: none;
|
|
}
|
|
:host /deep/ .annotationLayer .popupWrapper {
|
|
position: absolute;
|
|
width: 20em;
|
|
}
|
|
:host /deep/ .annotationLayer .popup {
|
|
position: absolute;
|
|
z-index: 200;
|
|
max-width: 20em;
|
|
background-color: #FFFF99;
|
|
box-shadow: 0px 2px 5px #333;
|
|
border-radius: 2px;
|
|
padding: 0.6em;
|
|
margin-left: 5px;
|
|
cursor: pointer;
|
|
word-wrap: break-word;
|
|
}
|
|
:host /deep/ .annotationLayer .popup h1 {
|
|
font-size: 1em;
|
|
border-bottom: 1px solid #000000;
|
|
padding-bottom: 0.2em;
|
|
}
|
|
:host /deep/ .annotationLayer .popup p {
|
|
padding-top: 0.2em;
|
|
}
|
|
:host /deep/ .annotationLayer .highlightAnnotation,
|
|
:host /deep/ .annotationLayer .underlineAnnotation,
|
|
:host /deep/ .annotationLayer .squigglyAnnotation,
|
|
:host /deep/ .annotationLayer .strikeoutAnnotation,
|
|
:host /deep/ .annotationLayer .fileAttachmentAnnotation {
|
|
cursor: pointer;
|
|
}
|
|
:host /deep/ .pdfViewer .canvasWrapper {
|
|
overflow: hidden;
|
|
}
|
|
:host /deep/ .pdfViewer .page {
|
|
direction: ltr;
|
|
width: 816px;
|
|
height: 1056px;
|
|
margin: 1px auto -8px auto;
|
|
position: relative;
|
|
overflow: visible;
|
|
border: 9px solid transparent;
|
|
background-clip: content-box;
|
|
border-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAA6UlEQVR4Xl2Pi2rEMAwE16fm1f7/r14v7w4rI0IzLAF7hLxNevBSEMEF5+OilNCsRd8ZMyn+a4NmsOT8WJw1lFbSYgGFzF2bLFoLjTClWjKKGRWpDYAGXUnZ4uhbBUzF3Oe/GG/ue2fn4GgsyXhNgysV2JnrhKEMg4fEZcALmiKbNhBBRFpSyDOj1G4QOVly6O1FV54ZZq8OVygrciDt6JazRgi1ljTPH0gbrPmHPXAbCiDd4GawIjip1TPh9tt2sz24qaCjr/jAb/GBFTbq9KZ7Ke/Cqt8nayUikZKsWZK7Fe6bg5dOUt8fZHWG2BHc+6EAAAAASUVORK5CYII=') 9 9 repeat;
|
|
background-color: white;
|
|
}
|
|
:host /deep/ .pdfViewer.removePageBorders .page {
|
|
margin: 0px auto 10px auto;
|
|
border: none;
|
|
}
|
|
:host /deep/ .pdfViewer.singlePageView {
|
|
display: inline-block;
|
|
}
|
|
:host /deep/ .pdfViewer.singlePageView .page {
|
|
margin: 0;
|
|
border: none;
|
|
}
|
|
:host /deep/ .pdfViewer .page canvas {
|
|
margin: 0;
|
|
display: block;
|
|
}
|
|
:host /deep/ .pdfViewer .page .loadingIcon {
|
|
position: absolute;
|
|
display: block;
|
|
left: 0;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: url('data:image/gif;base64,R0lGODlhGAAYAPQAAP///wAAAM7Ozvr6+uDg4LCwsOjo6I6OjsjIyJycnNjY2KioqMDAwPLy8nZ2doaGhri4uGhoaAAA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wzCgWdCIdeArczBQVbDJ0NAqyeBb64nQAGArBTt8R8mLuyPyEAOwAAAAAAAAAAAA==') center no-repeat;
|
|
}
|
|
`]
|
|
},] },
|
|
];
|
|
/** @nocollapse */
|
|
SimplePdfViewerComponent.ctorParameters = () => [
|
|
{ type: ElementRef, },
|
|
{ type: HttpClient, },
|
|
];
|
|
SimplePdfViewerComponent.propDecorators = {
|
|
"src": [{ type: Input },],
|
|
"removePageBorders": [{ type: Input },],
|
|
"disableTextLayer": [{ type: Input },],
|
|
"onLoadComplete": [{ type: Output, args: ['onLoadComplete',] },],
|
|
"onError": [{ type: Output, args: ['onError',] },],
|
|
"onProgress": [{ type: Output, args: ['onProgress',] },],
|
|
"onSearchStateChange": [{ type: Output, args: ['onSearchStateChange',] },],
|
|
};
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes} checked by tsc
|
|
*/
|
|
class SimplePdfViewerModule {
|
|
}
|
|
SimplePdfViewerModule.decorators = [
|
|
{ type: NgModule, args: [{
|
|
imports: [HttpClientModule],
|
|
declarations: [SimplePdfViewerComponent],
|
|
exports: [SimplePdfViewerComponent]
|
|
},] },
|
|
];
|
|
/** @nocollapse */
|
|
SimplePdfViewerModule.ctorParameters = () => [];
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes} checked by tsc
|
|
*/
|
|
/**
|
|
* Generated bundle index. Do not edit.
|
|
*/
|
|
|
|
export { SimplePdfViewerModule, SimplePdfViewerComponent, SimpleSearchState, SimpleDocumentInfo, SimpleOutlineNode, SimpleProgressData, SimpleSearchOptions, SimplePDFBookmark };
|
|
//# sourceMappingURL=simple-pdf-viewer.js.map
|