# print-splitter

> Splits up a DOM node into a set of pages for printing

Latest version **2.1.1** (published 2018-02-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install print-splitter
pnpm add print-splitter
yarn add print-splitter
bun add print-splitter
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2018-02-14 |
| First published | 2017-11-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 115.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | korynunn |

## Links

- npm: https://www.npmjs.com/package/print-splitter
- Repository: https://github.com/KoryNunn/print-splitter
- Homepage: https://github.com/KoryNunn/print-splitter#readme
- Issues: https://github.com/KoryNunn/print-splitter/issues
- npm.io page: https://npm.io/package/print-splitter

## Dependencies (1)

- [righto](https://npm.io/package/righto.md) ^3.2.0

## Recent versions

- 2.1.1 (latest) — 2018-02-14
- 2.1.0 — 2017-12-05
- 2.0.0 — 2017-12-04
- 1.1.0 — 2017-11-28
- 1.0.0 — 2017-11-24

## README

# print-splitter

Splits up a DOM node into a set of pages for printing

# Why

Printing DOM Sucks, page breaks don't work half the time
print-splitter chunks a target DOM node into page-sized bits.

# Example

https://korynunn.github.io/print-splitter/test/

# Usage

```javascript

    var splitter = require('print-splitter');

    var pageHeight = 1102; // "paper" height, 1082px is around A4 height.
    var minimumSplitHight = 200; // Don't split elements smaller than 200px, push them to the next page.

    // Function to detect elements that should cause a page-break
    // Return an array of optionally `['before', 'after']`
    var shouldPageBrake = function(element){
        return (element.getAttribute('pageBreak') || '').split(' ');
    };

    var pages = splitter(
        document.querySelector('.page'),
        pageHeight,
        minimumSplitHight,
        {
            shouldPageBrake: shouldPageBrake
        }
    );

    // `pages` will be in the DOM before the targeted node.

```

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