Flexible PDF Reporting in .NET Using IronPDF and Razor Views

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

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

  • @MilanJovanovicTech
    @MilanJovanovicTech  6 месяцев назад +3

    Get the source code for this video for FREE → the-dotnet-weekly.ck.page/html-to-pdf
    Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
    Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt

  • @drhdev
    @drhdev 6 месяцев назад +13

    QuestPDF has been one of the best tools I’ve ever worked with. Saved us sooo much money for reports and invoice layouts

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

      That's awesome. Did you run into any roadblocks with QuestPDF given that it's C# -> PDF?

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

      @@MilanJovanovicTech Honestly not at all, the one issue at first was file size but they have since fixed that issue. It's incredibly fast to create new reports/layouts, is pretty intuitive once you learn about the flow, and the hot-reload previewer is amazing

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

      but isn't quest pdf a paid library ?

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

      @@okharev8114 it’s free for companies with under $1mm revenue

  • @kodindoyannick5328
    @kodindoyannick5328 6 месяцев назад +2

    It's amazing. Personally i never used IronPDF neither another PDF library. After view this video I'll test IronPDF. Thanks Milan.

  • @AshrafTarek
    @AshrafTarek 6 месяцев назад +8

    IronPDF uses Chromium under the hood. You can achieve the same result without paying 1 cent for the tool. A more lightweight option would be wkhtml2pdf (little bit outdated though, in terms of CSS features), which could cover simple cases, like shown in the video.

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +2

      Little bit outdated? 😅

    • @AshrafTarek
      @AshrafTarek 6 месяцев назад +3

      @@MilanJovanovicTech Yes, the last update was in 2020 😬

    • @flobuilds
      @flobuilds 6 месяцев назад +2

      Still a good Option for simple stuff i mean 2020 is still pretty new and mostly nobody needs the new features and this way you can create a fully free pdf creation service for many things. My team and i through of using something like this

    • @AshrafTarek
      @AshrafTarek 6 месяцев назад +2

      @@flobuilds Yes it is. I used it a lot in my previous job. We could handle any case, like invoices, tickets with QR codes and customized badges in formats like A6.
      In my new job we decided to use Puppeteer with Chromium, where the browser runs in a docker container in headless mode, listening on a websocket for print jobs. This approach also allows you to scale PDF generation seperately and removes some load from your main application.

  • @BissultanYernazar
    @BissultanYernazar 6 месяцев назад +1

    Thank you for making these amazing videos! And, yes, I promise to stay 'awesome' until the next time)

  • @adamsilzell4968
    @adamsilzell4968 6 месяцев назад +4

    It would be cool to be able to have a footer per page with the html renderer.

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      I'll cover that in an article next few weeks

    • @Regan-iron
      @Regan-iron 6 месяцев назад

      Yes, IronPdf supports rendering headers and footers in PDF documents. You can easily add text or HTML headers and footers to your PDFs, allowing for customization such as including page numbers, logos, or other relevant information.

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

    Where I work we needed the presision which HTML just can't provide, therefore we went with QuestPDF, and it have been great. Sometimes you can feel from the lack of options that it is a 1 man project, but the options you don't have available isn't something you can't make yourself. We also had some issues with an update, which broke support for linux for a few days. But after reporting the problem to the dev, it got solved rather quickly, and he also seem to be pretty responsive to questions and problems that come in, can only recommend.
    We also tried IronPDF to see if it was good enough, due to its simplicity, but it wasn't due to the nature of html to pdf conversion. But if all you need to do is print out invoices and money isn't an issue, it is very simple to setup.

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      Interesting. What was your use case that HTML couldn't solve from a precision standpoint?
      There's always the risk of betting on a one-man project, though.

  • @DrHeinzDoofenshmirtz
    @DrHeinzDoofenshmirtz 6 месяцев назад +3

    I have looked into IronPdf a lot, and even though they are fairly good, their Chrome identical renderer is not completely Chrome identical, and it is super expensive.

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

      What did you end up choosing?

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

      @@MilanJovanovicTech I ended up with a solution where I use RazorLight for templating, and then I use Browserless which exposes Puppeteer as an API to turn HTML into a PDF file. It works great, but it is a bit slow to render the HTML before it saves it to a PDF.

  • @joseduque2406
    @joseduque2406 4 дня назад

    I have a license that is about a year or two years old of IronPdf library, but when you deploy your applications it is a hassle because some libraries have to be installed in the server. So if you are deploying to Linux, you may run into an issue where these libraries don’t get installed and you need up creating symbols to match the version it needs, very painful.

    • @MilanJovanovicTech
      @MilanJovanovicTech  4 дня назад

      Yeah, that part sucks

    • @joseduque2406
      @joseduque2406 4 дня назад

      I don’t know if they have fixed this issue yet, but it also deploys all the languages. In the version I have there was no way to select what languages to deploy. It would just deploy everything. By the way I really like you share a lot of your experience. Thank you!

  • @Dustyy01
    @Dustyy01 6 месяцев назад +2

    Nice Video and approach but sadly IronPDF is very expensive. A good alternative is QuestPDF but that's C# code to PDF. What is also working is using Razor Components (not views)

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

      QuestPDF is great library, I use it when I need to create PDFs, absolutely recommend it :)

    • @mateuszadamowicz770
      @mateuszadamowicz770 6 месяцев назад +1

      As everything it depends. If you know you would have constant structure of pdf file, you can use quest pdf and try to format file with quest pdf c# code. But there are some business cases when you need flexibility in customizing file template without deploying new version of the application (multitenancy for example)

    • @Dustyy01
      @Dustyy01 6 месяцев назад +1

      @@mateuszadamowicz770 yea i totally agree, that's why I mentioned that questpdf is c# code to pdf. It is more difficult to make flexible but has the same functionalities in generating the output pdf.

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

      How to add fields to the PDF so the users can type in them?

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      QuestPDF is an excellent tool, I enjoyed it

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

    On a real project, which endpoint resource group (controller) would you put this route to generate those invoices?
    /invoices
    /invoices-report (As you've shown us)
    /reports
    Which routes / resources would you usually put those reports generations?
    I have some "patterns" and thoughts around that, but I'd like to see your POV

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

      /invoices/id/report?
      /orders/id/invoice?
      A few ideas

  • @robotinike
    @robotinike 6 месяцев назад +1

    Ual, sensacional!
    amazing!!!!!!

  • @elpe21
    @elpe21 6 месяцев назад +3

    Well. such a interesting topic to cover and this time you video is just an ad :( 1. There are better 'paid' option: Syncfusion html to pdf with community license if you work for company with revenue under $1 million. 2. Quest PDF is such a great library to that a bit differentely. Lastly, you did not produced proper invoice document. No header, no page number, no nothing starting from page 2. Sorry ! I know you can do better, but you haven't in this video!

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

      Sorry for not implementing a production ready solution in 15 min, I guess. 🤷‍♂️ But this is more of a proof of concept, that can be extended further.
      As for the invoice structure, we can be nitpicky. It will depend on what you need to do. My invoices are way simpler than this, and I'm doing just fine. It doesn't have to be shiny.
      I didn't know about Syncfusion, will check it out. QuestPDF would have taken much more code to pull something like this off, p)us there's a learning curve to the library. Most teams will have someone good with HTML that could extend the implementation I showed.

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

      @@MilanJovanovicTech That's why I've mentioned syncfusion as it offers the same functionality. Using HTML table with / would not take longer than using divs but would've resolved a lot of issues. As a matter of fact, html table is the way to implement any kind of printed document ( official company's document ) and that should've been said as most important thing in the video no matter what tool it's being used to convert HTML to PDF. I agree that Quest PDF requires some practivce / kwnoledge.

  • @mikellouis100
    @mikellouis100 Месяц назад

    can we use it in a ClassLibrary project

  • @emiliowildberger7151
    @emiliowildberger7151 Месяц назад

    I can't decide, generate pdf in blazor wasm with the JsPdf library or generate in my webapi and view in blazor, the AI ​​doesn't recommend me in the webapi due to traffic, friend, what do you recommend me to generate in the frontend or in the backend?. Greetings from Paraguay.

    • @emiliowildberger7151
      @emiliowildberger7151 Месяц назад

      I forgot to mention that not all libraries work in Blazor Wasm

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

      Do you need to just display it to the user? It's probably fine doing it in WASM

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

    This and most solutions using (Razor) Views and models work best with fixed data structures. We have a solution that generates documents on structures where we don't know the fields, and don't know the content. The customer does know content and structure so we made our own field merging engine that can still be used with any type of template and is rendersed to pdf ultimately with EssentialObjects pdf (and just recently I added support for IronPdf as well). Our content could also generate export files with very variable length, and could even use several file based templates to generated compound documents.
    Because of the nature of our "models" we cannot use the very nice Model support that Razor has. If anyone has any ideas on how to use Models with unknown datastructures, perhaps even anonymous types I would love some direction because we could remove a lot of complex custom code :-) and rely more on standard libraries

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

      That sounds pretty cool. 😁
      If it works don't try to fix it?

  • @codecam9213
    @codecam9213 6 месяцев назад +1

    can we it with blazor web Assembly

  • @michaels8336
    @michaels8336 6 месяцев назад +1

    Any good libraries for reading/parsing a PDF document to get the data out of it?

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

      Other than IronPDF?

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

      @@MilanJovanovicTechit seems that the reading is very basic, I don’t want all text, I want to be able to say get the text from this table cell etc

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

    Just use seal report. It has payed converters but they are cheaper

  • @ruwantharatnayake5004
    @ruwantharatnayake5004 3 месяца назад

    RazorLightEngineBuilder to generate html template
    NReco.PdfGenerator to convert html to pdf

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 месяца назад

      Never heard of RazorLightEngineBuilder, interesting.

  • @sunzhang-d9v
    @sunzhang-d9v 6 месяцев назад +2

    It is better to introduce the free ones😂

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      I think I'll do a blog post reviewing a few libraries.

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

      @@MilanJovanovicTechwould love that 🎉

  • @codingbloke
    @codingbloke 6 месяцев назад +1

    I'm not convinced html -> pdf is good fit for this use case. This can be seen by the poor layout of multi page example at the end of the video.

  • @alegntayeyilma9564
    @alegntayeyilma9564 6 месяцев назад +13

    Very expensive commercial product 👎

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +4

      Developers are typically much more expensive 😅 That being said, what if it's the only solution to your problem? I bet you'd happily pay. Of course, it's an open market, and there are many other alternatives.

    • @DJOrangeJoe
      @DJOrangeJoe 6 месяцев назад +2

      True. I have seen so many cases where the company did not want to pay for such a product and paid way more eventually by developing it themselves.

    • @VincentYang024
      @VincentYang024 6 месяцев назад +1

      Is there anything come with no cost? We should support a good software that does the job well and help the business save the cost instead of writing some low quality and maintainable code to proof the existence of development.

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

      ​@@MilanJovanovicTechwhile its an interesting tool, but you could have let people know about the licensing, first before continuing showing it off. For smaller projects not interesting, for hobby projects also not interesting; for bigger companies sure.

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

      @@VincentYang024pdfsharp/migradoc

  • @nove1398
    @nove1398 6 месяцев назад +3

    D/M/Y is the only way! lol, you might have just started an issue, but I agree there🤜🏼

    •  6 месяцев назад +3

      only accepted date format should be the ISO :D
      anyways, no matter how you separate them, but we should keep going from larger units to smaller units as with every other thing in life. hours:minutes:seconds, millions,thousands,dollars.

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      This is the way!

  • @sunzhang-d9v
    @sunzhang-d9v 6 месяцев назад

    What to do with fresh chapters

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

      What do you mean by fresh chapters?

    • @sunzhang-d9v
      @sunzhang-d9v 6 месяцев назад

      @@MilanJovanovicTech sorry , is stamp

  • @joga_bonito_aro
    @joga_bonito_aro 6 месяцев назад +1

    I like yyyy/MM/dd way more. It can be sorted in a more meaningful way I think.
    On the topic. Can be done using OSS, but the implementation is mostly forced upon the programmer. It's not as simple as just calling one static method. Especially page brakes are a pain in the butt. I would guess that IronPDF is using the Chromium engine under the hood. So you could basically create IronPDF yourself, but the amount of work you have to put into it... brotha

  • @jithin.johnson
    @jithin.johnson 6 месяцев назад

    Milan, Can you do a video on using options pattern with a custom provider, say a sqlite database?

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      That'd be interesting idea, adding it to my content list

    • @jithin.johnson
      @jithin.johnson 6 месяцев назад

      @@MilanJovanovicTech Thanks, appreciate it.

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

    Great video. It's good you are not a FE developer

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 месяцев назад +1

      Lol 🤣 Doesn't matter, my website still looks pretty decent. 😁

  • @nepalxplorer
    @nepalxplorer 6 месяцев назад +1

    cool

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

    how to make excel reports?

  • @muhammadkamran-mx7yo
    @muhammadkamran-mx7yo 6 месяцев назад

    Please Make it with webapi and angular plz plz

  • @ВасилийКабанчиков
    @ВасилийКабанчиков 2 месяца назад

    Used DinkToPdf because its free