Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
print-this
Advanced tools
Printing plug-in for jQuery
$('selector').printThis();
$('#kitty-one, #kitty-two, #kitty-three').printThis({
importCSS: false,
loadCSS: "",
header: "<h1>Look at all of my kitties!</h1>"
});
Check the printThis wiki for common issues and questions
Covers common issues related to styling and printing limitations regarding page breaks
Now with TypeScript definitions.
Debug leaves the iframe visible on the page after printThis
runs, allowing you to inspect the markup and CSS.
Copy CSS <link>
tags to the printThis iframe. On by default.
Copy CSS <style>
tags to the printThis iframe. On by default.
Includes the markup of the selected container, not just its contents. On by default.
Provide a URL for an additional stylesheet to the printThis iframe. Empty string (off) by default.
Use a custom page title on the iframe. This may be reflected on the printed page, depending on settings. Blank by default.
Eliminates any inline style attributes from the content. Off by default.
Filter which inline style attributes to remove. Requires removeInline
to be true.
Accepts custom CSS/jQuery selectors. Default is "*"
The amount of time to wait before calling print()
in the printThis iframe. Defaults to 1000 milliseconds.
Appropriate values depend heavily on the content and network performance. Graphics heavy, slow, or uncached content may need extra time to load.
A string or jQuery object to prepend or append to the printThis iframe content. null
by default.
$('#mySelector').printThis({
header: "<h1>Amazing header</h1>"
});
$('#mySelector').printThis({
footer: $('.hidden-print-header-content')
});
jQuery objects are cloned rather than moved.
The base
option allows several behaviors.
By default it is false
, meaning a the current document will be set as the base URL.
If set to true
, a <base>
attribute will be set if one exists on the page.
If none is found, the tag is omitted, which may be suitable for pages with Fully Qualified URLs.
When passed as a string, it will be used as the href
attribute of a <base>
tag.
This setting copies the current values of form elements into the printThis iframe. On by default.
Canvas elements will be copied to the printThis iframe and you can call printThis directly on a canvas element if you choose.
A doctype string to use on the printThis iframe. Defaults to the HTML5 doctype.
Deletes script tags from the content to avoid errors or unexpected behavior during print. Disabled by default.
Copies classes from the body and html tags into the printThis iframe.
Accepts true
, "b"
, "h"
, or "bh"
to test for "b"
and "h"
for body and html tags, respectively.
Copies style attributes from the body and html tags into the printThis iframe.
Added to provide support for CSS Variables.
Accepts true
, "b"
, "h"
, or "bh"
to test for "b"
and "h"
for body and html tags, respectively.
Function to run inside the iframe before the print occurs.
This function has not been validated on all browsers.
Function called before the iframe is populated with content.
Function called after the print and before the iframe is removed from the page.
This is called even if debug: true
, which does not remove the iframe.
$("#mySelector").printThis({
debug: false, // show the iframe for debugging
importCSS: true, // import parent page css
importStyle: true, // import style tags
printContainer: true, // print outer container/$.selector
loadCSS: "", // path to additional css file - use an array [] for multiple
pageTitle: "", // add title to print page
removeInline: false, // remove inline styles from print elements
removeInlineSelector: "*", // custom selectors to filter inline styles. removeInline must be true
printDelay: 1000, // variable print delay
header: null, // prefix to html
footer: null, // postfix to html
base: false, // preserve the BASE tag or accept a string for the URL
formValues: true, // preserve input/form values
canvas: false, // copy canvas content
doctypeString: '...', // enter a different doctype for older markup
removeScripts: false, // remove script tags from print content
copyTagClasses: true, // copy classes from the html & body tag
copyTagStyles: true, // copy styles from html & body tag (for CSS Variables)
beforePrintEvent: null, // function for printEvent in iframe
beforePrint: null, // function called before iframe is filled
afterPrint: null // function called before iframe is removed
});
debug: true
and inspect the iframe. Please report your findings when reporting an issueThis project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
FAQs
Printing plug-in for jQuery
The npm package print-this receives a total of 0 weekly downloads. As such, print-this popularity was classified as not popular.
We found that print-this demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
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.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.