# pdf-ghost-report

> an open source solution for your nodejs reporting

Latest version **1.0.0** (published 2022-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install pdf-ghost-report
pnpm add pdf-ghost-report
yarn add pdf-ghost-report
bun add pdf-ghost-report
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-03-25 |
| First published | 2020-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 211.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Baraka Larbi |
| Maintainers | laridev |
| Keywords | pdf, node-pdf, nodepdf, typescript-pdf, puppeteer, puppeteer-pdf, easy-report-pdf |

## Links

- npm: https://www.npmjs.com/package/pdf-ghost-report
- Repository: https://github.com/ElitDevs/pdf-ghost-report
- Homepage: https://github.com/ElitDevs/pdf-ghost-report#readme
- Issues: https://github.com/ElitDevs/pdf-ghost-report/issues
- npm.io page: https://npm.io/package/pdf-ghost-report

## Dependencies (3)

- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.1
- [puppeteer](https://npm.io/package/puppeteer.md) ^13.5.1
- [handlebars](https://npm.io/package/handlebars.md) ^4.7.7

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-03-25
- 0.2.8 — 2020-08-12
- 0.2.7 — 2020-08-11
- 0.2.6 — 2020-05-19
- 0.2.5 — 2020-05-19
- 0.2.4 — 2020-05-19
- 0.2.3 — 2020-05-17
- 0.2.2 — 2020-05-17
- 0.2.1 — 2020-05-17
- 0.2.0 — 2020-05-17
- 0.1.0 — 2020-05-17

## README

# pdf-ghost-report

an open source solution for your nodejs reporting

[![Version npm](https://img.shields.io/npm/v/pdf-ghost-report)](https://www.npmjs.com/package/pdf-ghost-report) ![npm Downloads](https://img.shields.io/npm/dm/pdf-ghost-report) !['License'](https://img.shields.io/github/license/ElitDevs/pdf-ghost-report)

[![NPM](https://nodei.co/npm/pdf-ghost-report.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/pdf-ghost-report/)

![](images/pdf-ghost-report.png)

## Usage

```js
// example using express web framework
const express = require('express');
const { generatePdf } = require('pdf-ghost-report');
router = express.Router();
router.post('/getpdf', async (req, res, next) => {
  // step 01 : get template name
  const template_name = 'template_name';
  const data = req.body;
  // step 02 : call pdf making function by passing the template folder and name
  const config = {
    emulator: 'screen' || 'print',
    printBackground: true,
    format: 'A4',
    margin: {
      top: '50px',
      bottom: '50px',
      left: '20px',
      right: '20px',
    },
    displayHeaderFooter: true,
  };
  /**
   * args :
   *  templateFolderPath: string,
   *  templateFileName: string,
   *  templateExtension: string,
   *  config: object,
   *  data: object
   *
   * return stream
   * */
  const pdf = await generatePdf('templates', 'test', 'hbs', config, data);
  // // step 03 : return the blob pdf stream to the client
  res.writeHead(200, {
    'Content-Type': 'application/pdf',
    'Content-Disposition': `attachment; filename=${template_name}.pdf`,
    'Content-Length': pdf.length,
  });
  res.end(pdf);
});
module.exports = router;
```

## config

[For more config Info check Puppeteer pdf section](https://pptr.dev/#?product=Puppeteer&version=v3.0.4&show=api-pagepdfoptions)

## Installation

```bash
npm install pdf-ghost-report
```

```bash
yarn add pdf-ghost-report
```

## Run Tests

- for now we haven't created any test

```bash
npm test
```

## Todo

    [ ] add tests
    [ ] add docker
    [ ] support more template engins like : `ejs, ...etc`

#### Author: [BARAKA LARBI -laridev-]

---
_Source: https://npm.io/package/pdf-ghost-report · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
