Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Print HTML elements in modern browsers. :printer:
Printd is a small script to print HTMLElements. Printd opens the Print Dialog to print elements inside a blank document. It also supports CSS Text for custom styles.
:tada: View demo on CodePen.
yarn add printd --dev
npm install printd --save-dev
UMD file is also available on unpkg:
<script src="https://unpkg.com/printd/dist/printd.umd.min.js"></script>
You can use the library via window.printd
.
import Printd from 'printd'
// some styles for the element (optional)
const cssText = `
table {
font-size: 85%;
font-family: sans-serif;
border-spacing: 0;
border-collapse: collapse;
}
`
const d = new Printd()
// opens the "print dialog" of your browser to print the element
d.print( document.getElementById('mytable'), cssText )
import { Printd } from 'printd'
const cssText: string = `
h1 {
color: black;
font-family: sans-serif;
}
`
const d: Printd = new Printd()
d.print( document.getElementById('myelement'), cssText )
The constructor supports an optional parent element (HTMLElement
) where the printable element will be appended. Default value is window.document.body
.
Example:
const d = new Printd( document.getElementById('myparent') )
Prints the current HTMLElement
.
Params:
HTMLElement
to print.win.print()
to trigger the printing.
Window
reference.Document
reference.HTMLElement
reference.Basic example:
const d = new Printd()
d.print( document.getElementById('h1'), `h1 { font-family: serif; }` )
Callback example:
const d = new Printd()
const cssText = `
.code {
font-family: monospace;
}
`
d.print(document.getElementById('mycode'), cssText, (win, doc, node) => {
// trigger the printing
win.print()
})
Feel free to send some Pull request or issue.
MIT license
© 2017 José Luis Quintana
FAQs
Print HTML elements in modern browsers.
The npm package printd receives a total of 4,785 weekly downloads. As such, printd popularity was classified as popular.
We found that printd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.