import "bootstrap.css"
import { NgModule, enableProdMode } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {Component} from '@angular/core';
import './app.css';
import {DsPdfViewer} from '@mescius/dspdfviewer';
import '/document-solutions/javascript-pdf-viewer/demos/resource/js/init.js';
@Component({
selector: 'app-component',
templateUrl: 'src/app.component.html'
})
export class AppComponent {
ngAfterViewInit() {
const viewer = new DsPdfViewer("#viewer", {
workerSrc: "/document-solutions/javascript-pdf-viewer/demos/product-bundles/build/dspdfviewer.worker.js",
cMapUrl: "/document-solutions/javascript-pdf-viewer/demos/product-bundles/build/resources/bcmaps/",
restoreViewStateOnLoad: false
});
viewer.addDefaultPanels();
viewer.open("/document-solutions/javascript-pdf-viewer/demos/product-bundles/assets/pdf/helloworld.pdf");
}
}
@NgModule({
imports: [BrowserModule, NgbModule],
declarations: [AppComponent],
exports: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
//
enableProdMode();
// Bootstrap application with hash style navigation and global services.
platformBrowserDynamic().bootstrapModule(AppModule);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Angular reference sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Polyfills -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/3.34.0/minified.js"></script>
<!-- SystemJS -->
<script src="node_modules/systemjs/dist/system.js"></script>
<script src="systemjs.config.js"></script>
<script>
// workaround to load 'rxjs/operators' from the rxjs bundle
System.import('rxjs').then(function (m) {
System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators));
System.import('./src/app.component');
});
</script>
</head>
<body>
<app-component></app-component>
</body>
</html>
<div id="viewer">
</div>
(function (global) {
System.config({
transpiler: 'ts',
typescriptOptions: {
tsconfig: true
},
meta: {
'typescript': {
"exports": "ts"
},
'*.css': { loader: 'css' }
},
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'core-js': 'npm:core-js/client/shim.min.js',
'zone': 'npm:zone.js/dist/zone.min.js',
//'reflect-metadata': 'npm:reflect-metadata/Reflect.js',
'rxjs': 'npm:rxjs/bundles/rxjs.umd.min.js',
//'rxjs': 'npm:rxjs',
//'rxjs/operators': 'npm:rxjs/operators',
'@angular/core': 'npm:@angular/core/bundles/core.umd.min.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.min.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.min.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.min.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.min.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.min.js',
'@angular/common/http': 'npm:@angular/common/bundles/common-http.umd.min.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.min.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.min.js',
'@mescius/dspdfviewer': 'npm:@mescius/dspdfviewer/dspdfviewer.js',
'@ng-bootstrap/ng-bootstrap': 'npm:@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.umd.js',
'bootstrap.css': 'npm:bootstrap/dist/css/bootstrap.min.css',
'jszip': 'npm:jszip/dist/jszip.min.js',
'typescript': 'npm:typescript/lib/typescript.js',
//'typescript': 'https://unpkg.com/typescript@3.2.2',
'ts': 'npm:plugin-typescript/lib/plugin.js',
'css': 'npm:systemjs-plugin-css/css.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
src: {
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
},
// 'rxjs': {main: 'index.js', defaultExtension: 'js' },
// 'rxjs/ajax': {main: 'index.js', defaultExtension: 'js' },
//'rxjs/operators': {main: 'index.js', defaultExtension: 'js' },
// 'rxjs/testing': {main: 'index.js', defaultExtension: 'js' },
// 'rxjs/webSocket': {main: 'index.js', defaultExtension: 'js' },
"node_modules": {
defaultExtension: 'js'
},
}
});
})(this);