Nextjs and React PDF Tutorial: WATCH THIS BEFORE STARTING YOUR PDF

Поделиться
HTML-код
  • Опубликовано: 1 дек 2024

Комментарии • 73

  • @MarvelCodes
    @MarvelCodes Год назад +34

    “I don’t know what that means, I just know that this works” - The stranger that saved my job.

    • @tuffilaro1565
      @tuffilaro1565 Год назад +2

      "This knowledge has been passed down for generations" vibe

    • @ytpeerz
      @ytpeerz Месяц назад +1

      got laughing harder than I want to admit 🤣🤣

  • @_jackmad
    @_jackmad Год назад +8

    For Next.js 14 only write "use client" on top of your page.js file, before the import lines, below these lines, write const styles and const MyDocument functions ,inside page, write the useState and useEffect and inside the return the pdfViewer, to this tag add style={{ 'width': '100%', 'height': '100v' }} so that the PDFViewer is the full size on the page, with this you eliminate the need to place dynamic and create two different components, it works for me :D

  • @gobindsingh212
    @gobindsingh212 2 года назад +8

    I love the enthusiasm and how you're so fired up to share your knowledge. You earned a sub :)

  • @georgesngandeu9115
    @georgesngandeu9115 Год назад +8

    Thank you, if you want to display the pdf with a larger height and width, just add a class to pdfViewer and set the desired width and height in the class. For small screen use media query to transition

  • @josh4play.youtube
    @josh4play.youtube 5 месяцев назад

    bro you literally saved my life - i downloaded the video just in case you ever take it down i have some refference

  • @hassanbello1535
    @hassanbello1535 Год назад

    Great tutorial!
    A useful alternative I found was to 'screenshot' whatever component I wanted rendered and render it as an image with react-pdf, with this I could add everything I wanted.

  • @TareiKing-j6z
    @TareiKing-j6z Год назад +4

    I don't even need to use this packaging, but I stayed to watch because you are awesome! Can feel the 'pain' you went through, thanks for sharing.

  • @tiifuhamza1397
    @tiifuhamza1397 Год назад +1

    Hello there. Thank you for this wonderful video. i have struggled over this bug for a month.Thank You and more videos

  • @ramizazhar8891
    @ramizazhar8891 Год назад +3

    If you guys wondering why your custom font doesn’t work. Just try on style on component, not component.

  • @arturoordonez-hernandez8750
    @arturoordonez-hernandez8750 Год назад +3

    FYI: you'll need to run npm i next for your project to find dynamic, not npm i @next-tools/dynamic. As for the tiny PDF Viewer, try adding in some styles like so in your PDFView component (the one below where you have the as the root component):

  • @Elxroid
    @Elxroid Год назад +1

    dude legit kekw's in a dev tutorial at 6:23
    Thanks for the vid defo let me know of a few pitfalls I didn't realise I was already in

  • @ytpeerz
    @ytpeerz Месяц назад +1

    Dude it worked!!!!!
    thanks a bunch 🔥🔥🔥

  • @petrsonTD
    @petrsonTD Год назад

    Dude you dont even know how large problem it was for me load image to my pdf. it's always said it cant get to it. Then I remembered that I week ago I watched this video and you said to use folder ...publick/assets. you saved me.

  • @MichaelSoriano
    @MichaelSoriano 2 года назад +2

    That was the best ending. Yaaah. Anyway, thanks for this. Can’t wait to try it out.

  • @extensus4842
    @extensus4842 Год назад +3

    Great video, was incredibly helpful. The fix to the size I found is adjusting the width and height in a global stylesheet on the Iframes.

  • @vncstudio
    @vncstudio Год назад

    I had a lot of issues trying to get this work yesterday!

  • @arturoordonez-hernandez8750
    @arturoordonez-hernandez8750 Год назад

    Thanks for making this! I still have to rework this a bit for my use case at work, but thanks for helping me get started! I tried using react-to-pdf but I couldn't get it to work; it makes use of a componentRef and it was just complicating things for me with what I'm doing.

  • @ifeoraokechukwu1346
    @ifeoraokechukwu1346 11 месяцев назад

    You are a life-saver ! Thanks a lot 👍🏾👍🏾👍🏾👍🏾👍🏾👍🏾

  • @mingyangliu6910
    @mingyangliu6910 2 месяца назад

    Thank you! react-pdf is hard to use for real when used with nextjs

  • @shytypes1028
    @shytypes1028 2 года назад

    may your days be long and filled with the lustfully desires of all neards and developers all over the world. you just saved my ass.

  • @kyraezikeuzor
    @kyraezikeuzor Год назад

    Thank you so much. Wow this is a big help.

  • @jonathanadel3831
    @jonathanadel3831 9 месяцев назад

    That was really helpful, thank you.

  • @GermansEagle
    @GermansEagle 10 месяцев назад

    Ssr false is just removing server side rendering. You are making it a client component. In the new nextjs you don't need to do this. Just "use client"

  • @srubio604
    @srubio604 2 года назад

    Hey, can you continue explainin g the styling , taking values from an d api and stuff like that?, this is the best video on the creation of PDF in NEXTjs

  • @adamczarny6482
    @adamczarny6482 6 месяцев назад

    hugeee dose of knowledge

  • @ramizazhar8891
    @ramizazhar8891 Год назад

    you can style the PDFViewer component with 100% width or anything you want.

  • @vladimirplyukhin5234
    @vladimirplyukhin5234 Год назад

    Awesome! Do you know how to open a PDF in a new tab?

  • @faustozambrano4901
    @faustozambrano4901 Год назад

    Thanks for letting me out the gutter, budd

  • @abhisycvirat
    @abhisycvirat Год назад

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

  • @kyosukefukumoto9382
    @kyosukefukumoto9382 Год назад

    I love how you explain everything haha
    can you import pdf like you've done with an Image?

  • @huynhkieu5236
    @huynhkieu5236 Год назад

    Thank you so much. You save me

    • @nevajnosovsem2369
      @nevajnosovsem2369 Год назад

      Hi. Do you know how to turn a PDF into a Blob?
      i cant take anymore.....

  • @higorskowronskidesouza1692
    @higorskowronskidesouza1692 10 месяцев назад

    Please, new Tutorial with Next - 14 !!

  • @CoderMK
    @CoderMK Год назад

    Hi thanks for help can you help me with challenge I would really appreciate I want to create content table page like we have in books, problem is I don't know how to assign page number to in content table because I don't know how many pages chapter 1 will take and chapter 2 will start at what

  • @amatir-tutor2421
    @amatir-tutor2421 Год назад

    How to create table?

  • @malaizyogmuzumala7736
    @malaizyogmuzumala7736 2 года назад +1

    Thanks alot man, is it possible to create PDFs with dynamic content, like a receipt or something?

    • @AlexGalo0
      @AlexGalo0 Год назад

      this is what i need to know

  • @marekchoinski5431
    @marekchoinski5431 Год назад

    Thank you, it was very helpful

  • @vncstudio
    @vncstudio Год назад

    I finally got it to work but it is a hideous mess. It shows the original page as well as a raw text version and then the nav buttons are displayed on a third page. Going to take a look at your code.

  • @danieltorres7634
    @danieltorres7634 Год назад

    Gracias por el video.
    Para la comunidad latina

  • @traam_889
    @traam_889 Год назад +1

    Almost shot myself, this was driving me crazy lmao

  • @patrickrios99
    @patrickrios99 Год назад

    thank you

  • @MaxSai-j9b
    @MaxSai-j9b Год назад

    After git clone, if you see in the left corner white square try to change the font to some default like Font.register({ family: "Helvetica", src: "/path/to/helvetica.ttf" });

  • @edgarmacas3331
    @edgarmacas3331 2 года назад

    hi, when run "npm run build", I get this error "PDFViewer is a web specific API. You're either using this component on Node, or your bundler is not loading react-pdf from the appropriate web build " any solution please.

    • @MarkSchewe
      @MarkSchewe 2 года назад +1

      Watch the hole video. The trick is to generate a second view to display the document with disabled SSR

    • @ganatraarpita5982
      @ganatraarpita5982 Год назад

      @@MarkSchewe I did that and still get the error while building my next.js app

  • @ryadallali4340
    @ryadallali4340 Год назад

    i got this err : Error: PDFViewer is a web specific API. You're either using this component on Node, or your bundler is not loading react-pdf from the appropriate web build.
    This error happened while generating the page. Any console logs will be displayed in the terminal window.

    • @brendanbois5365
      @brendanbois5365  Год назад +1

      I'm sorry it's been so long since I've done anything with this. If I were you I'd ask chatGPT lol, it legit might know exactly how to fix this

  • @rohanmiscelionius5074
    @rohanmiscelionius5074 10 месяцев назад

    Error: PDFDownloadLink is a web specific API. You're either using this component on Node, or your bundler is not loading react-pdf from the appropriate web build.
    getting this error in production but works fine on local
    i did ll the steps same as shown in video
    i am using next js 13

  • @stacksagar
    @stacksagar 2 года назад

    Hello Bro, Amazing tutorial

  • @reactDevelopment
    @reactDevelopment Год назад

    in latest next js do this work

  • @joaomoreira4784
    @joaomoreira4784 2 года назад

    thanks! you save me

  • @sphoorthys7983
    @sphoorthys7983 2 года назад

    can you please share the git link of the above tutorial?

  • @yangenmanuel2659
    @yangenmanuel2659 Год назад

    Amazing bro! Did you have the error:
    PDFViewer is a web specific API. You're either using this component on Node, or your bundler is not loading react-pdf from the appropriate web build.
    When building the application? I`m having problems with that
    Thanks for the help!

    • @nevajnosovsem2369
      @nevajnosovsem2369 Год назад

      Hi. Do you know how to turn a PDF into a Blob?
      i cant take anymore.....

    • @yangenmanuel2659
      @yangenmanuel2659 Год назад

      @@nevajnosovsem2369 got no idea how to do it. If you know how to i will be really thankful.

    • @yangenmanuel2659
      @yangenmanuel2659 Год назад

      @@nevajnosovsem2369 I found the solution! On your next.config file you should add:
      const nextConfig = {
      /* all your config */
      swcMinify: false,
      }

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 года назад

    Awesome help +++++++++++++++++ Thank You 😀

  • @DaniBZone
    @DaniBZone Год назад

    Is there a way to make it bigger? Instead of zooming in the pdf? It's pretty hard

    • @ramizazhar8891
      @ramizazhar8891 Год назад

      I use tailwind,

    • @MarvelCodes
      @MarvelCodes Год назад

      global.css set an iFrame css declaration and give the height and width you want, the Document tag fills it up.

  • @eternl_sunshine22
    @eternl_sunshine22 5 месяцев назад

    make more vids bro

  • @knrking007
    @knrking007 10 месяцев назад

    I had an issue with fs not defined or some issues ,this code worked for me
    module.exports = {
    webpack: (config, { isServer }) => {
    if (!isServer) {
    // Exclude 'fs' module from client-side bundle
    config.resolve.fallback = {
    ...config.resolve.fallback,
    fs: false,
    };
    }
    return config;
    },
    };