Giter Site home page Giter Site logo

ngx-foxitpdfsdkforweb's Introduction

ngx-foxitpdfsdkforweb

This is Foxit pdf web sdk for Angular.

Install

npm install ngx-foxitpdfsdkforweb --save

Setup

1 Modify your angular.json

"assets": [
  ...,
  {"glob": "**/*", "input": "./node_modules/ngx-foxitpdfsdkforweb/lib", "output": "/node_modules/ngx-foxitpdfsdkforweb/lib"}
],

2 Modify your tsconfig.json

"files": [
  ...
  "node_modules/ngx-foxitpdfsdkforweb/foxitWebPDFComponent.ts"
],

3 Add FoxitWebPDFComponent to app NgModule.

import { FoxitWebPDFComponent } from 'ngx-foxitpdfsdkforweb';

@NgModule({
  declarations: [
    ...
    FoxitWebPDFComponent,
  ],
  ...
})

4 Copy license-key.js to folder src/app and import.

import { licenseSN, licenseKey} from './license-key';

Use

1 You can add the tag in the template and set attribute fileUrl. The style position MUST be absolute.

<foxit-webpdf #foxitWebPDF style="position: absolute;width:600px;height:800px;" licenseSN="{{licenseSN}}" licenseKey="{{licenseKey}}" fileUrl="{{fileUrl}}"></foxit-webpdf> 

Attribute

  • licenseSN
  • licenseKey
  • fileUrl
  • password

2 You can also open pdf in the typescript code.

Template

<input type="file" (change)="openPDF($event)"/>

<foxit-webpdf #foxitWebPDF style="position: absolute;width:600px;height:800px;" licenseSN="{{licenseSN}}" licenseKey="{{licenseKey}}"></foxit-webpdf> 

Component

import { Component, Input, ViewChild } from '@angular/core';
import { licenseSN, licenseKey} from './license-key';
import { FoxitWebPDFComponent } from 'ngx-foxitpdfsdkforweb';

export class AppComponent {
  @ViewChild('foxitWebPDF', {static: false}) foxitWebPDF:FoxitWebPDFComponent; 
  licenseSN = licenseSN;
  licenseKey = licenseKey;


  openPDF($event){
    const fileSelected: File = $event.target.files[0];
    this.foxitWebPDF.openFile(fileSelected);
  }

  openPDFByUrl(url:string){
    this.foxitWebPDF.openPDFByHttpRangeRequest(url);
  }
}


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.