<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Umar Luqman</title>
    <description>The latest articles on DEV Community by Umar Luqman (@umarlqmn).</description>
    <link>https://dev.to/umarlqmn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F376557%2F79a77e65-6b93-41ad-b834-f9faea11aa4b.jpg</url>
      <title>DEV Community: Umar Luqman</title>
      <link>https://dev.to/umarlqmn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umarlqmn"/>
    <language>en</language>
    <item>
      <title>Designing for Print in React</title>
      <dc:creator>Umar Luqman</dc:creator>
      <pubDate>Fri, 11 Sep 2020 09:54:50 +0000</pubDate>
      <link>https://dev.to/umarlqmn/designing-for-print-in-react-5c9h</link>
      <guid>https://dev.to/umarlqmn/designing-for-print-in-react-5c9h</guid>
      <description>&lt;h2&gt;
  
  
  Libraries in React
&lt;/h2&gt;

&lt;p&gt;Before I know there is an easy way to style the components for print, I use &lt;a href="https://github.com/diegomura/react-pdf"&gt;@react-pdf/renderer&lt;/a&gt; which allow better customization and doesn't use the native browser function. &lt;/p&gt;

&lt;p&gt;But I need to recreate the same component again using the primitive component from the library. It was double the work for my use case.&lt;/p&gt;

&lt;p&gt;Then I found &lt;a href="https://github.com/gregnb/react-to-print"&gt;react-to-print&lt;/a&gt; library. The library is easy to use and the doc is great. The native print function would work fine in most cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Style for print
&lt;/h2&gt;

&lt;p&gt;Here are some CSS snippets I wish I know it earlier for printing web pages &lt;/p&gt;

&lt;h3&gt;
  
  
  Style for printing separately 👇
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MWCdAUpZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.prismic.io/blog-next/e8c01362-56ca-4043-8ad9-6c82e46ebafe_carbon%2B%25283%2529.png%3Fauto%3Dcompress%2Cformat" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MWCdAUpZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.prismic.io/blog-next/e8c01362-56ca-4043-8ad9-6c82e46ebafe_carbon%2B%25283%2529.png%3Fauto%3Dcompress%2Cformat" alt="print preview in react snippet 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoid page styling break when a page break
&lt;/h3&gt;

&lt;p&gt;CSS to avoid the component being cut when there is a page break 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MWCdAUpZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.prismic.io/blog-next/e8c01362-56ca-4043-8ad9-6c82e46ebafe_carbon%2B%25283%2529.png%3Fauto%3Dcompress%2Cformat" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MWCdAUpZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.prismic.io/blog-next/e8c01362-56ca-4043-8ad9-6c82e46ebafe_carbon%2B%25283%2529.png%3Fauto%3Dcompress%2Cformat" alt="print in react snippet 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let me know if anything you would like me to add.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>css</category>
      <category>print</category>
      <category>codesnippet</category>
    </item>
  </channel>
</rss>
