Then these properties will break down the page wherever this property has been applied while printing the web page. The simplest solution is to ensure your grid will adapt to this size appropriately, though this may not be acceptable since you may want the large view to print rather than the smaller view. As a result, this will tell react-pdf that we want the browser's PDF viewer to take up all of the space on the page Asking for help, clarification, or responding to other answers. Connect and share knowledge within a single location that is structured and easy to search. How to automatically classify a sentence or text based on its context? To ensure the proper image is displayed in the print we highly recommend setting the poster attribute of the video, which allows specifying an image to be a placeholder for the video until the video loads. This can be used to change the content on the page before printing, Callback function that triggers before print. It can be applied wherever required, inside the table, before or after the table or before or after a row, and even within a row. Note: under the hood, we inject a custom, Set the nonce attribute for whitelisting script and style -elements for CSP (content security policy), Style incompatibilities with print media rendering. The simplest solution is to ensure your grid will adapt to this size appropriately, though this may not be acceptable since you may want the large view to print rather than the smaller view. Now we simply need to call the html2pdf () method and pass this element to it as shown below Now if you open the application the pdf file will be downloaded automatically as an attachment as you can see As you can see the content is split up into 2 pages with page break but there is some problem out there. If you've created a component that is intended only for printing and should not render in the parent component, wrap that component in a div with style set to { display: "none" }, like so: This will hide ComponentToPrint but keep it in the DOM so that it can be copied for printing. The component accepts the following props: If you need extra control over printing and don't want to specify trigger directly, PrintContextConsumer allows you to gain direct access to the handlePrint method which triggers the print action. page-break isn't a directly usable property but it contains three properties that can be used as per requirement: page-break-before: adds a page break before an element We also do our best to support IE11. In addition, they can cause all sorts of undesirable behavior. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. How to force page break using react-to-print library? Please see this answer on StackOverflow for how to do this. If you know of a way we can solve this, your help would be greatly appreciated. Do NOT pass an `onClick` prop. Always insert a page-break after a