Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gadingnst/simple-print
Simple Javascript utility to print HTML element easier.
https://github.com/gadingnst/simple-print
element-print html-print javascript print
Last synced: 12 days ago
JSON representation
Simple Javascript utility to print HTML element easier.
- Host: GitHub
- URL: https://github.com/gadingnst/simple-print
- Owner: gadingnst
- License: mit
- Created: 2019-09-11T19:09:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T10:00:17.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T12:20:34.390Z (about 1 month ago)
- Topics: element-print, html-print, javascript, print
- Language: JavaScript
- Homepage: https://sutanlab.js.org/simple-print
- Size: 421 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Simple Print
[![GitHub](https://img.shields.io/github/license/sutanlab/simple-print)](https://github.com/sutanlab/simple-print) [![Build Status](https://travis-ci.org/sutanlab/simple-print.svg?branch=master)](https://travis-ci.org/sutanlab/simple-print) [![npm](https://img.shields.io/npm/dt/simple-print.svg)](https://www.npmjs.com/package/simple-print) [![npm](https://img.shields.io/bundlephobia/min/simple-print.svg)](https://unpkg.com/simple-print/lib/bundle/simple-print.min.js) [![GitHub issues](https://img.shields.io/github/issues/sutanlab/simple-print.svg)](https://github.com/sutanlab/simple-print/issues)
> Simple Javascript utility to print HTML element easier.
## Getting started
##### See [Demo Here](https://jsfiddle.net/sutanlab/d72ke1sL)
### 1. Use Package with NPM or YARN with ES6 import
```bash
# with npm
$ npm i simple-print --save# or with yarn
$ yarn add simple-print
``````js
import SimplePrint from 'simple-print'
```### 2. With CDN
```html
```
## How to Use
### Simple use
```js
var print = new SimplePrint({
styles: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
'assets/css/your.css'
]
})function btnClick() {
print.render(document.getElementById('element-to-print'))
}
```### With advanced options and callback
```js
var element = document.getElementById('element-to-print')var opts = {
name: '_blank',
specs: [
'fullscreen=yes',
'titlebar=yes',
'scrollbars=yes'
],
styles: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css'
]
}var print = new SimplePrint(opts)
function btnClick() {
// you can assign your new options like this
print.options = {
styles: [
'your-path/other-style.css'
]
}print.render(element, function() {
console.log('Printing completed or was cancelled!')
})
}
```## Support Me
### Global
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/gadingnst)
### Indonesia
- [Trakteer](https://trakteer.id/gadingnst)
- [Karyakarsa](https://karyakarsa.com/gadingnst)---
Feel free to contribute [simple-print](https://github.com/sutanlab/simple-print) 🙂
Copyright © 2019 by Sutan Gading Fadhillah Nasution