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

@vivliostyle/print

Package Overview
Dependencies
Maintainers
0
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vivliostyle/print

Allows page-layouting using the vivliostyle for printing within a website without destroying the original layout

  • 2.30.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
244
increased by12.44%
Maintainers
0
Weekly downloads
 
Created
Source

vivliostyle-print

Allows page-layouting using the vivliostyle for printing within a website without destroying the original layout

How do I use it?

  1. Install vivliostyle-print like this within your browser-based JavaScript project:
npm install @vivliostyle/print --save
  1. Use it within your project like this:
import {printHTML} from '@vivliostyle/print'

const htmlDoc = `<!doctype html>
<html>
    <head>
        <style>
        ... Add your CSS code here ...
        </style>
    </head>
    <body>
        ... Add your HTML code here ...
    </body>
</html>`,
    config = {
        title: 'my printed page',
        printCallback: iframeWin => iframeWin.print() // optional: only needed if calling something other than window.print() for printing.
        errorCallback: message => alert(message) // optional: only needed if you want to handle errors.
    }

printHTML(htmlDoc, config)

You can also take a look at the demo (sourcecode) .

How do I build and run the demo?

  1. Download the repo to your local machine, for example using::
git clone https://github.com/vivliostyle/vivliostyle-print.git
  1. Enter the folder::
cd vivliostyle-print
  1. Install and build it::
npm install
npm run build_demo
  1. Serve the demo folder, for example using the simple PHP webserver::
php -S localhost:8000 -t demo/
  1. Access the demo from a web browser by navigating to http://localhost:8000

Why would I use this rather than regular Vivliostyle?

On larger projects, it can be difficult to ensure that no developer is accidentally breaking the terms of the Vivliostyle AGPL license. Vivliostyle-print only exposes one of the functions of Vivliostyle that does not allow the sharing of complex data structures between surrounding code and Vivliostyle, which is the most important requirements to follow when using VIvliostyle in combination with a non-open source project. For more information cocnerning the license, read this.

Please report any bugs and open pull requests on the Vivliostyle main repo.

Keywords

FAQs

Package last updated on 27 Nov 2024

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