Styling React-PDF with Custom Fonts & Dynamic Page Styles

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • Yo, In this video, we will dive into the world of React-PDF and how to style it with custom fonts and dynamic page styles. This is an amazing way to create dynamic PDFs in your React applications, providing a rich user experience.
    Our journey will take us from the basics of React-PDF to applying custom fonts and, finally, to creating dynamically styled pages.
    🔗 Useful Links:
    Code Repository: github.com/ars...
    Previous Video: • ReactPDF Basic Setup
    React-PDF Documentation: react-pdf.org/
    If you find this video helpful, don't forget to hit that like button and subscribe for more content like this. Also, feel free to drop your questions or suggestions in the comments section below.
    Happy Coding! 🚀
    LINKS: linktr.ee/arsl...
    Please don't forget Like, Comment and Subscribe if you're new!

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

  • @zanokuhlehita7668
    @zanokuhlehita7668 7 หลายเดือนก่อน +1

    Thank you guys for these videos they are value

  • @mangkoeboemie
    @mangkoeboemie 2 หลายเดือนก่อน +1

    im rendering a booking receipt that sometime is really long how to break to new pages automatically?

    • @arslan99
      @arslan99  2 หลายเดือนก่อน

      @@mangkoeboemie hmmm you could try asynchronous await

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

    Hey @Arslan I just started watching your videos and they are really good. I was wondering if you knew how to create an endpoint that receives some data from the client and generates a react PDF in memory, which can then be sent as an attachment to an email using nodemailer. I am having troubling finding out how to generate a PDF in memory and then send the attachment, nodemailer seems to need a path to a file when sending attachments. How would you go about this? Anything will help, and thanks for these videos, been really helpful.

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

      This should help now it's not exactly what you need but it's close
      th-cam.com/video/-_hRWBpaJZk/w-d-xo.htmlsi=z00CZqti-kQuc9Tc

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

    getting this error ./node_modules/@react-pdf/font/lib/index.browser.es.js
    Attempted import error: 'create' is not exported from 'fontkit' (imported as 'fontkit').

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

      it could be misspelled im not too sure sorry

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

    Can you please help to set fixed header and footer for each page, please.

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

    Nicely shown and explained. Good stuff as always - I dropped a like 👍
    I know this may be off topic but have you ever used tRPC? I used it once but didn't get too deep into and the same goes for tailwindcss. I'd be interested in seeing you work your magic on one of those topics. But if you already got stuff in the pipeline then no worries. I always learn something new from you bro. Thanks 😎

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

      Hey bro, thanks for the support 😄. I've never heard of tRPC or used it before but after looking it up a bit, it looks pretty interesting 🤔. I think it would be a pretty good tutorial to make I'll add it to the list. And for tailwindcss I've always wanted to use it and to make tutorials on it thanks for reminding of them I'm gonna add them to the list to teach after electron is over. I really appreciate all the ideas 💡

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

      @@arslan99 awesome, yes that electron tutorial is fire and I have been learning a ton from it. Glad to hear you got more tutorial videos on it coming. And no prob, ya I been thinking about using tRPC for future projects but I don't have too much knowledge about it. tailwindcss seems pretty good for putting UIs together quickly and would be interested in seeing that as well. Looking forward to you dropping those tutorials in the future bro. Thanks

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

      Alright Lemme look into it because if those two things will help you out I'd be glad to teach it 😁

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

    You are a Legend Arslan, thank you so much! Problem solved! 🥳

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

      I'm glad you got it 😄

  • @supriyadutta3411
    @supriyadutta3411 11 วันที่ผ่านมา

    I tried this method but it is throwing module not found error

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

    How are you supposed to render on client side. I am using PDFViewer but it loads the window is way too small.

  • @ged9925
    @ged9925 11 หลายเดือนก่อน

    How can you rerender the PDFViewer whenever there are changes?

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

    Getting this error TypeError: fontkit__WEBPACK_IMPORTED_MODULE_6__.create is not a function

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

    I want to show data in table but unable to do it can u suggest something how can i achive this

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

      You can use a regular html table to do that and use react pdf to display it

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

      Tried it but didn't work

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

      @@ashwinsolanki6549 I'd recommend asking chat gpt it's a quick and easy way just provide it the video and what you want it to do 😁

  • @LoïcGuégan-g1m
    @LoïcGuégan-g1m ปีที่แล้ว +1

    Does it mean that the style that you apply to your components (display, colors, positions, etc.) will be the same on the PDF style ? Making it possible to "design" the PDF

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

      Yes it should I'd recommend double checking the docs but the basic customization I did in the tutorial should help you get started 😄

  • @DavidPopa-x3m
    @DavidPopa-x3m ปีที่แล้ว

    can i use multiple Fonts (and how) ?

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

      I'm sure there has to be a way to do that I'm not sure off the top of my head sorry

    • @DavidPopa-x3m
      @DavidPopa-x3m ปีที่แล้ว +1

      @@arslan99
      import RobotoBold from "./fonts/Roboto-Bold.ttf";
      import RobotoItalic from "./fonts/Roboto-Italic.ttf";
      import RobotoBoldItalic from "./fonts/Roboto-BoldItalic.ttf";
      Font.register({
      family: "Roboto",
      fonts: [
      {
      src: RobotoBold,
      fontWeight: "bold",
      },
      {
      src: RobotoItalic,
      fontWeight: "normal",
      fontStyle: "italic",
      },
      {
      src: RobotoBoldItalic,
      fontWeight: "bold",
      fontStyle: "italic",
      },
      ],
      format: "truetype",
      }); this works,

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

      @@DavidPopa-x3m oh nice I'm glad you got it, so you just put them all into the array.

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

    Emotional video 😭🙏

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

      Thank you kind sir 🥺