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

react-to-print

Package Overview
Dependencies
Maintainers
2
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-to-print - npm Package Versions

1
10

2.8.0

Diff

Changelog

Source

2.8.0 (May 19th, 2020)

  • FEATURE 245: documentTitle prop can now be passed to set a default filename when the user is saving as a PDF. Thanks zb2oby

  • FEATURE 244: trigger is now an optional prop. To print without it we now offer two new options.

    PrintContextConsumer with a render-props pattern:

    import { PrintContextConsumer } from 'react-to-print';
    
    <ReactToPrint content={() => this.componentRef}>
      <PrintContextConsumer>
        {({ handlePrint }) => <button onClick={handlePrint}>Print this out!</button>}
      </PrintContextConsumer>
    </ReactToPrint>
    

    useReactToPrint for hook-based printing

    import { useReactToPrint } from 'react-to-print';
    
    const Example = () => {
      const componentRef = useRef();
      const handlePrint = useReactToPrint({ content: () => componentRef.current });
    
      return (
        <div>
          <ComponentToPrint ref={componentRef} />
          <button onClick={handlePrint}>Print this out!</button>
        </div>
      );
    };
    

    Huge thanks to vtsybulin for these fantastic additions.

  • CHORE: upgrade devDependencies to latest

herbstmb
published 2.8.0-beta.1 •

herbstmb
published 2.7.0 •

Changelog

Source

2.7.0 (May 1st, 2020)

  • FEATURE 198: pageStyle prop can now be passed as a function. Thanks sergeyshmakov
  • FIX 218: Image duplication in Edge and IE. This should also fix 211 (slow performance with many images on the page). Thank you dioscarey for helping to get this pushed through
  • Fix 93: Check for existence of target.contentWindow.print
  • CHORE: updated an error message (see 96)
  • CHORE: updated all devDependencies to latest
  • CHORE: slightly decreased size of the build by better using UglifyJS
  • CHORE: enabled TypeScript strict mode
  • CHORE: added a "Compatibility" section to the README. Also moved some sections around and shortened the example
  • CHORE: improved browser built targets based on browserslist best practices
herbstmb
published 2.7.0-beta.2 •

herbstmb
published 2.7.0-beta.1 •

herbstmb
published 2.6.3 •

Changelog

Source

2.6.3 (March 9th, 2020)

  • FIX 227 Add a title to the print iframe to improve accessibility. Thanks invious
herbstmb
published 2.6.2 •

Changelog

Source

2.6.2 (March 8th, 2020)

  • FIX 224 Handle the content prop returning null. This is required for proper usage in TypeScript strict mode. Thanks a-sync
herbstmb
published 2.6.1 •

Changelog

Source

2.6.1 (March 3rd, 2020)

  • CHORE 220 Added suppressErrors documentation to the README
herbstmb
published 2.6.0 •

Changelog

Source

2.6.0 (March 3rd, 2020)

  • FEATURE 220 Adds a suppressErrors prop. When passed, console logging of errors is disabled. Thanks invious
herbstmb
published 2.5.1 •

Changelog

Source

2.5.1 (January 9th, 2020)

  • CHORE 208 Minor improvements to code comments, linting, and README

  • CHORE 207 Updated devDependencies

  • FIX 204: Ensure images are fully loaded before printing. Previously long-loading images might not be included in the print. This ensures that we wait for them to load, similar to how we wait for style sheets to load. Thanks nhanhuynh-agilityio

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