1.0.7 • Published 3 years ago

reportlayer v1.0.7

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

ReportLayer JavaScript SDK

Embed template-driven PDF documents in your web application. This library is for use with any JavaScript-based web application, and includes React components as well.

This library is intended for use with a ReportLayer account. For a free ReportLayer account, go to https://www.reportlayer.com.

Examples

Show a download link (React)

import React, { Component } from 'react';
import { DownloadLink } from 'reportlayer/react';

const API_KEY = '<Your API key from your ReportLayer dashboard>';
const TEMPLATE_ID = '<The report template ID, from your ReportLayer dashboard>';

class App extends Component {
  render() {
    return (
      <div>
        <DownloadLink templateId={TEMPLATE_ID} apiKey={API_KEY}>
          Click me to download the report
        </DownloadLink>
      </div>
    );
  }
}

export default App;

Display a report on-screen (React)

import React, { Component } from 'react';
import { DocumentView } from 'reportlayer/react';

const API_KEY = '<Your API key from your ReportLayer dashboard>';
const TEMPLATE_ID = '<The report template ID, from your ReportLayer dashboard>';

class App extends Component {
  render() {
    return (
      <div>
        <DocumentView templateId={TEMPLATE_ID} apiKey={API_KEY} />
      </div>
    );
  }
}

export default App;

Display a report on-screen (plain JavaScript)

import reportlayer from 'reportlayer';

const apiKey = '<Your API key from your ReportLayer dashboard>';
const templateId = '<The report template ID, from your ReportLayer dashboard>';

const data = { /* ...your data to populate the report */ };

const containerDomEl = document.querySelector('.report-container');  // Target container element

reportlayer.init(apiKey); // Only needs to be done once
reportlayer.render(containerDomEl, templateId, data)

Download a report to a file (plain JavaScript)

import reportlayer from 'reportlayer';

const apiKey = '<Your API key from your ReportLayer dashboard>';
const templateId = '<The report template ID, from your ReportLayer dashboard>';

const data = { /* ...your data to populate the report */ };

reportlayer.init(apiKey); // Only needs to be done once
reportlayer.download(templateId, data);

License

MIT

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

0.0.2

5 years ago

1.0.0

7 years ago