1.0.235 • Published 2 months ago

@ezeep/ngx-ezeep-js v1.0.235

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

NgxEzeepJs

This library was generated with Angular CLI version 12.2.0.

Overview

The ezeep.js JavaScript library implements the ezeep Blue API to easily offer printing capabilities to any web application. Integrate a printing feature to your web application with just a few steps.

Integration Guide

Getting started

  1. Sign up for an ezeep Blue account. This creates an administrator account and a new ezeep organization. Sign up here

  2. Register your web application to receive your Client-ID. Contact the ezeep team at helpdesk@ezeep.com and provide the Redirect Uri of your web application. This Uri must host the ezeep.js component.

Integration in your Angular App

Important: You need to set up your server with https!

  1. Inside your Angular App, install the package via npm:
npm install @ezeep/ngx-ezeep-js
  1. Import the EzeepJSAngularModule in the module of your choice (e.g. app module)
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { EzeepJSAngularModule } from '@ezeep/ngx-ezeep-js';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    EzeepJSAngularModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. The package comes with assets, to use them, do the following:

    3.1 In the angluar.json file of your project, add this:

    ...
    "assets": [
      {
        "glob": "**/*",
        "input": "./node_modules/@ezeep/ezeep-js/dist/ezeep/assets",
        "output": "./assets/"
      }
    ],
    ...

    3.2 Additionally, you need to tell stencil where to find the assets, so add this to your main.ts file

    ...
    import { setAssetPath } from '@stencil/core'
    ...
    setAssetPath(location.origin)
    ...
  2. Add the ezp-printing tag to your html source.

<ezp-printing></ezp-printing>

There are multiple required and optional attributes the ezp-printing element needs in order to provide the print functionality.

AttributeDescriptionTypeRequired
clientidYour registered Client-ID (see above).stringYes
redirecturiYour registered Redirect Uri (see above).stringYes
triggerbutton: renders a print button that opens the print dialog upon clicking itcustom: renders no element, but allows create a custom element or trigger to open the print dialogfile: renders a an area to allow drag and drop of a filestringYes
fileurlA url pointing to a file that should be printed. E.g. https://your-site.com/myfile.pdfstringRequired, if trigger is set to button or custom.
filenameThe name of the file that is printed.stringNo. Only used for trigger button and custom.
filetypeThe type of the file that is printed.stringNo. Only used for trigger button and custom.
hideloginIf set to true, no additional info popup is shown before the user authentication.booleanNo
hidemenuIf set to true, the menu is not shown.booleanNo
authapihosturlOverrides the default URL of the authentication API.stringNo
printapihosturlOverrides the default URL of the printing API.stringNo
themeThe overall color theme. Possible colors are pink, red, orange, green, cyan, blue and violet.stringNo
appearanceSets the overall appearance to "light", "dark" or the "system" default.stringNo
languageOverrides the browserlanguage. Possible values are "de" for German and "en" for English.stringNo

Example with button trigger

To get started, you can use the default ezeep print button within your web app:

component.html

<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
    <script type="module" src="https://cdn.ezeep.com/ezeep-js/ezeep.esm.js"></script>
    <script nomodule src="https://cdn.ezeep.com/ezeep-js/ezeep.js"></script>
    <title>ezeep-js</title>
  </head>
  <body>
    <ezp-printing
      clientid="your-client-id"
      redirecturi="https://your-site.com/"
      trigger="button"
      fileurl="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
      filename="dummypdf"
      filetype="pdf"
    >
    </ezp-printing>
  </body>
</html>

Example with custom trigger

If you want to bind the printing process to a custom html element, you can use this example:

<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
    <script type="module" src="https://cdn.ezeep.com/ezeep-js/ezeep.esm.js"></script>
    <script nomodule src="https://cdn.ezeep.com/ezeep-js/ezeep.js"></script>
    <title>ezeep-js</title>
    <style>
      .customButton {
        background-color: DodgerBlue;
        border: none;
        border-radius: 6px;
        color: white;
        padding: 12px 16px;
        font-size: 16px;
        cursor: pointer;
      }

      .customButton:hover {
        background-color: RoyalBlue;
      }
    </style>
  </head>
  <body>
    <ezp-printing
      clientid="your-own-client-id"
      redirecturi="https://your-site.com/"
      trigger="custom"
      filename="dummypdf"
      fileurl="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
      filetype="pdf"
    >
      <button class="customButton">My custom styled print button</button>
    </ezp-printing>
    <script>
      const ezpPrinting = document.querySelector('ezp-printing')
      const button = document.querySelector('button')

      button.onclick = async () => await ezpPrinting.open()
    </script>
  </body>
</html>

Example with file trigger (Drag&Drop)

<!DOCTYPE html>
<html dir="ltr" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
    <script type="module" src="https://cdn.ezeep.com/ezeep-js/ezeep.esm.js"></script>
    <script nomodule src="https://cdn.ezeep.com/ezeep-js/ezeep.js"></script>
    <title>ezeep-js</title>
    <style>
      /*
      you can set the width and height of the upload field, for example like this:
      (if no width or height is set, it defaults to "auto")
      */
      :root {
        --ezp-upload-width: calc(80vw);
        --ezp-upload-height: calc(80vh);
      }
    </style>
  </head>
  <body>
    <ezp-printing
      clientid="oWuvEAndErO3kKCqzaWBOAs2PhOuAbD7MZYWQ9yJ"
      redirecturi="https://develop.dev.azdev.ezeep.com:3333"
      trigger="file"
      theme="blue"
      appearance="system"
    >
    </ezp-printing>
  </body>
</html>

component.ts

export class AppComponent implements OnInit {
  ezpPrinting: any; 
  
  ngOnInit() {
    this.ezpPrinting = document.querySelector('ezp-printing');
  }
  
  onClick() {
    this.ezpPrinting.open();
  }
}

Code scaffolding

Run ng generate component component-name --project ngx-ezeep-js to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-ezeep-js.

Note: Don't forget to add --project ngx-ezeep-js or else it will be added to the default project in your angular.json file.

Build

Run ng build ngx-ezeep-js to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build ngx-ezeep-js, go to the dist folder cd dist/ngx-ezeep-js and run npm publish.

Running unit tests

Run ng test ngx-ezeep-js to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

1.0.235

2 months ago

1.0.233

2 months ago

1.0.234

2 months ago

1.0.232

2 months ago

1.0.231

3 months ago

1.0.230

4 months ago

1.0.229

4 months ago

1.0.225

10 months ago

1.0.220

1 year ago

1.0.221

1 year ago

1.0.219

1 year ago

1.0.217

2 years ago

1.0.216

2 years ago

1.0.213

2 years ago

1.0.215

2 years ago

1.0.214

2 years ago

1.0.211

2 years ago

1.0.210

2 years ago

1.0.209

2 years ago

1.0.200

2 years ago

1.0.206

2 years ago

1.0.205

2 years ago

1.0.208

2 years ago

1.0.207

2 years ago

1.0.202

2 years ago

1.0.201

2 years ago

1.0.204

2 years ago

1.0.203

2 years ago

1.0.189

2 years ago

1.0.198

2 years ago

1.0.197

2 years ago

1.0.194

2 years ago

1.0.193

2 years ago

1.0.196

2 years ago

1.0.195

2 years ago

1.0.190

2 years ago

1.0.192

2 years ago

1.0.191

2 years ago

1.0.187

2 years ago

1.0.186

2 years ago

1.0.188

2 years ago

1.0.183

2 years ago

1.0.182

2 years ago

1.0.184

2 years ago

1.0.181

2 years ago

1.0.180

2 years ago

1.0.176

2 years ago

1.0.177

2 years ago

1.0.179

2 years ago

1.0.172

2 years ago

1.0.165

2 years ago

1.0.164

2 years ago

1.0.167

2 years ago

1.0.166

2 years ago

1.0.163

2 years ago

1.0.169

2 years ago

1.0.171

2 years ago

1.0.170

2 years ago

1.0.143

2 years ago

1.0.142

2 years ago

1.0.145

2 years ago

1.0.144

2 years ago

1.0.161

2 years ago

1.0.160

2 years ago

1.0.141

2 years ago

1.0.140

2 years ago

1.0.147

2 years ago

1.0.149

2 years ago

1.0.148

2 years ago

1.0.156

2 years ago

1.0.155

2 years ago

1.0.150

2 years ago

1.0.151

2 years ago

1.0.139

2 years ago

1.0.158

2 years ago

1.0.157

2 years ago

1.0.138

2 years ago

1.0.159

2 years ago

1.0.137

2 years ago

1.0.132

2 years ago

1.0.131

2 years ago

1.0.134

2 years ago

1.0.133

2 years ago

1.0.130

2 years ago

1.0.136

2 years ago

1.0.135

2 years ago

1.0.129

2 years ago

1.0.128

2 years ago

1.0.127

2 years ago