# @sugo/wkhtmltopdf

> A wrapper for the wkhtmltopdf HTML to PDF converter

Latest version **1.0.2** (published 2019-02-27) · 0 weekly downloads

## Install

```sh
npm install @sugo/wkhtmltopdf
pnpm add @sugo/wkhtmltopdf
yarn add @sugo/wkhtmltopdf
bun add @sugo/wkhtmltopdf
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-02-27 |
| First published | 2019-02-13 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Francisco Javier Sucre González |
| Maintainers | franciscojsucreg |

## Links

- npm: https://www.npmjs.com/package/@sugo/wkhtmltopdf
- Repository: https://github.com/franciscosucre/sugo-wkhtmltopdf
- Homepage: https://github.com/franciscosucre/sugo-wkhtmltopdf#readme
- Issues: http://github.com/franciscosucre/sugo-wkhtmltopdf/issues
- npm.io page: https://npm.io/package/@sugo/wkhtmltopdf

## Recent versions

- 1.0.2 (latest) — 2019-02-27
- 1.0.1 — 2019-02-15
- 1.0.0 — 2019-02-13
- 0.3.4 — 2019-02-13

## README

# **@sugo/wkhtmltopdf**

Simple promise-based wrapper for wkhtmltopdf.

## **Requirements**

node version >= 8
[wkhtmltopdf](https://wkhtmltopdf.org/index.html) installed

## **How to install**

```shell
npm install --save @sugo/wkhtmltopdf
```

## **Create a PDF**

From a HTML

```typescript
const buffer = await wkhtmltopdf('<p>Test</p>');
```

From a URL

```typescript
const buffer = await wkhtmltopdf('http://www.google.com');
```

## **Serve a pdf with a NodeJS Http Server**

```typescript
const filename = 'foo.pdf';
const buffer = await wkhtmltopdf('http://www.google.com');
res.setHeader('Content-Type', 'application/pdf');
res.setHeader('Content-Disposition', `attachment; filename=${filename}.pdf`);
res.setHeader('Content-Length', buffer.byteLength);
res.end(buffer);
```

## **Options**

The wkhtmltopdf function recieves a list of [wkhtmltopdf options](https://wkhtmltopdf.org/usage/wkhtmltopdf.txt).

## **Example**

```typescript
const buffer = await wkhtmltopdf('<p>Test</p>', ['--no-footer-line']);
```

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