Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

page-wrapping

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

page-wrapping

[![npm](https://img.shields.io/npm/v/page-wrapping.svg)](https://www.npmjs.com/package/page-wrapping) [![Travis](https://img.shields.io/travis/react-pdf/page-wrapping.svg)](https://travis-ci.org/react-pdf/page-wrapping)

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
7.6K
increased by12.02%
Maintainers
1
Weekly downloads
 
Created
Source

page-wrapping

npm Travis

Generic page wrapping algorithm proposal.

How it works

import wrapPage from 'page-wrapping'

// Create node instance.
// It can be whatever type of construction you want, but should always if support Node interface (see below).
const node = Node({ left: 20, top: 20, width: 100, height: 100 })

// Start page wrapping process.
// You should pass as first argument the page children (in this case only one node),
// and as second argument the page height used to wrap the elements.
await wrapPage([node], 40)

// [
//   { left: 20, top: 20, width: 100, height: 20 },
//   { left: 20, top: 0, width: 100, height: 40 },
//   { left: 20, top: 0, width: 100, height: 40 }
// ]

Node interface

PropertyDescriptionType
leftNode x coordinateNumber
topNode y coordinateNumber
widthNode widthNumber
heightNode heightNumber
minPresenceAheadPresence ahead of element to not to breakNumber
wrapWhether a node should be able to split in two or moreBoolean
breakWhether a node should create a page breakBoolean
fixedWhether a node should repeat throughout all pagesBoolean
parentNode pointer to parentNode
childrenChildren nodesArray
appendChildAdd node as childrenFunction
removeDetach node from parenFunction
cloneReturns a copy of target nodeFunction
nodeWillWrapCallback before element wrap. Can return promiseFunction
onNodeSplitCallback after element is split in twoFunction
isEmptyReturns if node is empty or notFunction

FAQs

Package last updated on 06 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc