React to PDF Printing | React Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • We will learn how to convert anything inside React component into PDF file and be able to print. Let's find out, guys!
    SUBSCRIBE: bit.ly/Subscrib... & turn on notifications to find out when I upload new videos.
    Hong Ly Tech
    honglytech.com
    Websites used in this video
    www.npmjs.com/...
    COVID-19 Live Now URL
    GitHub Repo
    github.com/lyh...
    GitHub Pages URL: lyhd.github.io...
    Netlify URL: vigilant-noeth...
    Website: www.hongly-port...
    Medium: / lyhong.rupp
    Facebook: / honglytechfb
    Facebook Page: / honglytech
    Instagram: / hongly_tech
    Twitter: / honglytech
    Facebook Page (Think): / kitthink
    #react #pdf #printing

ความคิดเห็น • 66

  • @2Dimples4U
    @2Dimples4U 3 ปีที่แล้ว +2

    Exactly what I needed. Is there a way to have that little print icon that usually wraps around a window of a component?

  • @KamalMaulanaAdha
    @KamalMaulanaAdha ปีที่แล้ว

    so helpful
    thanks

  • @tbtester3378
    @tbtester3378 3 ปีที่แล้ว +2

    What if we already have an app written with functional components? The above doesn't work.

  • @kdgyimah
    @kdgyimah 3 ปีที่แล้ว +3

    Thanks for the tutorial, I got the same result with {window.print()}.
    Is there a way to save the PDF file into the state? I want to submit the file to the backend on generation

  • @Deepak-ye8vt
    @Deepak-ye8vt ปีที่แล้ว

    Nice explanation with less time.Great Job sir.

  • @yuribaldini1126
    @yuribaldini1126 2 ปีที่แล้ว

    Thanks for sharing!! It was really helpfull.

  • @HARSH11ify
    @HARSH11ify 2 ปีที่แล้ว

    Thanks buddy, you're a saviour!!

  • @AjayKumar-jx5qb
    @AjayKumar-jx5qb 10 หลายเดือนก่อน

    Just wondering if there is a way to add page number and table of contents for larger content. Thank.

  • @chiragprajapati6312
    @chiragprajapati6312 3 ปีที่แล้ว +1

    hey nice, but what if I want to add some header to print but I don't want to show it on component

  • @StephenArpad
    @StephenArpad 6 หลายเดือนก่อน

    How can i reduce the whole content inside the printing page?
    I tried overloading the pageStyle prop, but for some unkown reason to me, it's not doing anything.
    Any ideas?
    Thanks

  • @MrTouqeerhameed
    @MrTouqeerhameed 3 ปีที่แล้ว

    Thank you for the wonderful tutorial

  • @VishalPatel-hl8ir
    @VishalPatel-hl8ir 4 ปีที่แล้ว +1

    I want to create an Invoice on button click & export same invoice in pdf. Can you please help me to do the same ?

  • @redyk4073
    @redyk4073 3 ปีที่แล้ว

    Thank you guy it's was helpful

  • @travel_worldwide_365
    @travel_worldwide_365 3 ปีที่แล้ว

    Nice explanations .Great !

  • @shivampawar8421
    @shivampawar8421 3 ปีที่แล้ว

    Thanks for sharing

  • @hemanthkumar9137
    @hemanthkumar9137 4 ปีที่แล้ว +1

    thanks for this tutorial :)

  • @khandoor7228
    @khandoor7228 4 ปีที่แล้ว

    Nice tool Hong thanks for showing this.

  • @gangaprasadk
    @gangaprasadk 3 ปีที่แล้ว +5

    Thanks for the tutorial. Its great. Can we make ComponentToPrint as a functional component instead of class component. Also, can we print directly without the Print Dialog.

    • @utkarshsinghchauhan7113
      @utkarshsinghchauhan7113 2 ปีที่แล้ว

      did you get the solution for printing directly without the print dialog box?

    • @gangaprasadk
      @gangaprasadk 2 ปีที่แล้ว

      @@utkarshsinghchauhan7113 no

  • @sayantansaha2703
    @sayantansaha2703 3 ปีที่แล้ว

    if i need to change that printing page style,how to set that ? for an example in my webpage there is an auto generated qrcode, and i want to print that only & also i want that QR-image printed in the middle of that a4.please help!!

  • @ngneerin
    @ngneerin 3 ปีที่แล้ว

    Best

  • @istvanerdos7682
    @istvanerdos7682 2 ปีที่แล้ว +1

    Hey! Thanks for sharing this! Do you have any idea about how I could print a table with scrollable content? I've tried to set it to landscape mode, but it does not work for me.

    • @akinjidesleek
      @akinjidesleek 2 ปีที่แล้ว +2

      If its a table you should probably try downloading in csv format with react-csv

    • @istvanerdos7682
      @istvanerdos7682 2 ปีที่แล้ว +1

      @@akinjidesleek Thank you! Finally, we decided to create a custom print component for it in which the cells are breaking down into the next line. I have used flexbox divs to build the "breakable" table component.

    • @uzmamustafa3293
      @uzmamustafa3293 2 ปีที่แล้ว

      Can you show me the custom print component output, i need to print a scrollable content table too so.

    • @priyan6380
      @priyan6380 2 ปีที่แล้ว +1

      @@uzmamustafa3293 same I'm also having problem while printing scrollable content

  • @ahmaat19
    @ahmaat19 3 ปีที่แล้ว +1

    Can I use with hooks because it's giving me an error that needs only class-based components?

    • @BenniK88
      @BenniK88 3 ปีที่แล้ว

      Did you find an answer?

    • @ahmaat19
      @ahmaat19 3 ปีที่แล้ว +1

      @@BenniK88 yes.

    • @BenniK88
      @BenniK88 3 ปีที่แล้ว +1

      @@ahmaat19 Can you help me. As I got the same issue. Can you post your solution? Thanks in advance

    • @ahmaat19
      @ahmaat19 3 ปีที่แล้ว

      @@BenniK88 you can find how I implemented here github.com/ahmaat19/restaurant-system

  • @mrskrish9584
    @mrskrish9584 3 ปีที่แล้ว

    Any possibility to specify where to page break

  • @Fattpiu
    @Fattpiu 2 ปีที่แล้ว

    What happens if my printer is out of ink or out of paper?
    Is there a way to capture that?

  • @SHATHISHB
    @SHATHISHB 5 หลายเดือนก่อน

    how to add page numbers?

  • @abubakarwaqas9807
    @abubakarwaqas9807 3 ปีที่แล้ว

    Pdf is creating but when I tried to select text than it was not select ? please can you tell me what is the reason. Thanks advance

  • @sivaprasadreddy5038
    @sivaprasadreddy5038 4 ปีที่แล้ว

    hi i am facing isse with when we print checked checkbox and selected dropdown value not printed can u pls help me on that

  • @kacperkepinski4990
    @kacperkepinski4990 2 ปีที่แล้ว

    can i add something as a footer for every page?

  • @Jay-bh9ke
    @Jay-bh9ke 3 ปีที่แล้ว

    Does it support print all tab content instead of active tab

  • @RyuAdventures
    @RyuAdventures 3 ปีที่แล้ว

    Nice tutorial I have a question, Does it works inside a React+Electron APP ?

  • @fattchong1619
    @fattchong1619 2 ปีที่แล้ว

    how do you use the onPrintError function?

  • @saikalyan8073
    @saikalyan8073 3 ปีที่แล้ว

    Can we do this get a power point presentation

  • @arghyapaul8760
    @arghyapaul8760 3 ปีที่แล้ว

    Suppose if we want to ignore a table coloum before coverting it to pdf and when it will be converted to pdf then in the pdf file the last or first coloum will be removed. how will I do that

  • @bunnyngim2758
    @bunnyngim2758 3 ปีที่แล้ว

    Hi Any vdo talk about electronJS and Vue with Printer? Thank

    • @honglytech
      @honglytech  3 ปีที่แล้ว

      Not yet bro. But I added the two items to the list

  • @webamplifiereducation1768
    @webamplifiereducation1768 2 ปีที่แล้ว

    is this can be used for pos?

  • @abhishekshah2964
    @abhishekshah2964 3 ปีที่แล้ว

    How to print with one row at a time with this ?

  • @johanrivas8015
    @johanrivas8015 4 ปีที่แล้ว +1

    the component to print must be a class component ?

    • @travelfiend
      @travelfiend 4 ปีที่แล้ว +1

      Yep, seems that way. You get a weird error when trying with function components

    • @johanrivas8015
      @johanrivas8015 4 ปีที่แล้ว

      @@travelfiend thanks for replying

    • @markbarlescu1853
      @markbarlescu1853 3 ปีที่แล้ว

      @@travelfiend Is this still an issue? I'm going to be using this soon. So the component to print MUST be a class component still?

  • @AjayKumar-rr3lj
    @AjayKumar-rr3lj 3 ปีที่แล้ว

    In browser . we can give ctrl + P in any website it will show print as pdf so why we are doing code like this.can you explain?

    • @honglytech
      @honglytech  3 ปีที่แล้ว

      You can try window.print()

    • @AjayKumar-rr3lj
      @AjayKumar-rr3lj 3 ปีที่แล้ว

      @@honglytech Thank you

  • @allaboutvideos4788
    @allaboutvideos4788 3 ปีที่แล้ว +1

    Thank, Will this work on android app?

    • @honglytech
      @honglytech  3 ปีที่แล้ว

      This is only running in the browsers. Not mobile apps.

  • @rajeshkolluri448
    @rajeshkolluri448 ปีที่แล้ว

    If possible explain the code

  • @asyncasync
    @asyncasync 3 ปีที่แล้ว +3

    A complete and utter waste of time and absolutely useless. You cannot select the text after generating the PDF. This is like an April fools joke. What exactly is the point of this if you cannot copy the text?

  • @manujamadushan9471
    @manujamadushan9471 2 ปีที่แล้ว

    😍

  • @basitbasit2547
    @basitbasit2547 3 ปีที่แล้ว

    not good in production mode :'(

  • @its_just_me_
    @its_just_me_ 3 ปีที่แล้ว

    At the time I am watching this, the video has 11k views, 111 likes and 11 dislikes..
    😄

  • @blood4bones366
    @blood4bones366 4 ปีที่แล้ว

    Thank you for this

  • @leelalekkala5587
    @leelalekkala5587 3 ปีที่แล้ว

    sir in my case instead of save option it is showing print option. after clicking on print option it disappear. how will I solve that?