7.0.737 • Published 2 years ago

@mstechusa/eviewer7-cli v7.0.737

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

eViewer

npm.io

A HTML5-based document viewer built on Angular and JavaScript technologies for the highest level of performance and integration into your applications. eViewer is multi-platform, multi-device compatible to provide the greatest versatility and amazing user experience.

Build Status

Supported platform

eViewer requires the following for deployment:

  • Server OS: Linux(x64) excluding Alpine, Windows(x64)
  • Java: 8 and higher

eViewer Installation

Install the dependencies and devDependencies and start the server.

https://eviewer.net/frameworks/

Copy Assets

Copy assets and resources to your assets folder. 

These assets need to be served with your application.

The folder you need to copy is node_modules/@mstechusa/eviewer7-cli/assets.

Embed Viewer Component conditionally into the template html

<div *ngIf="isViewerLoad">
    <lib-eviewer-lib></lib-eviewer-lib>
</div>

Import eViewerApp class, and check for Viewer Component load event by subscribing to isViewerLoaded Subject of eViewerApp class

import { Component } from '@angular/core';
import { IntegrationService } from './integration/integration.service';
import { eViewerApp } from 'eviewer7-cli';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent {
  title = 'eviewer-lib-application';
  subscription: any;
  isViewerLoad: boolean = false;
  constructor(
    private eViewer_App: eViewerApp
  ) {
    this.subscription = this.eViewer_App.isViewerLoaded.subscribe((value) => {
      this.isViewerLoad = value;
    });
  }
  ngOnDestroy(): void {
    this.subscription.unsubscribe();
  }
}

Inject DocumentService into your component's constructor'

  constructor(
    private documentService: DocumentService,
  ) {}

Invole loadViewer API pf eViewerApp and initialize by calling setDocumentEndPointOptions API'

 loadViewer() {
    let savingEndPoint = "";
    let viewerServerURL = "";
    const authToken = "";
    const userName = "demo";
    const saveMultipartPayLoadType = true;
    const hideToolBar = false;
    let savePayloadType = 'application/json';

    if (saveMultipartPayLoadType === true) {
      savePayloadType = 'multipart/form-data';
    }
    let options = {
      type: 'GET',
      headers: {
        Authorization: 'Bearer ' + authToken,
        Accept: 'application/octet-stream.',
      },
      savePayLoadType: savePayloadType,
    };

    this.eViewer_App.loadViewer();

    this.eViewer_App.setDocumentEndPointOptions(
      viewerServerURL,
      savingEndPoint,
      userName,
      options,
      hideToolBar
    );
  }

Load Document by calling loadDocument API of DocumentService'

	let uploadData = {
      repositoryType: 'filesystem',
      docUrl: "http://someurltodocument",
      annotationUrl: "http://someurltoannotations",
      clientDocID: "somedocID",
      dbUsername: "demo",
    };

    this.documentService.loadDocument(uploadData);

License

Please visit https://eviewer.net or https://mstusa.com to learn more about licensing eViewer