The Free Way to Create Awesome PDFs in .NET

Поділитися
Вставка
  • Опубліковано 29 гру 2024

КОМЕНТАРІ • 262

  • @TheCodeCreator
    @TheCodeCreator 3 місяці тому +2

    Well, doesn't matter what I was using. I will start using this approach in small and simple projects from now on. Amazing! Thanks for sharing.

  • @xakzpc
    @xakzpc 3 місяці тому +4

    wow, amazing timing, I just explored ways to create pdfs literally yesterday

  • @Siddiskongen
    @Siddiskongen 3 місяці тому +71

    No library. installed playwright ....

    • @Synesthesia-r9
      @Synesthesia-r9 11 днів тому

      I guess Nick meant that there is no third party library being used, it's all Microsoft.

  • @catalindanciu1212
    @catalindanciu1212 3 місяці тому +3

    Thank you for sharing this relatively simple trick Nick. Here's how I do it whenever business requires pdfs: I just tell them to prepare the templates as excel or word documents and then proceed to use NPOI to populate the data, and after that use LibreOffice headless (sofice executable) to convert to pdf. It's not the fastest or most accurate (especially if you have intricate formatting documents), but hey...it's free and it also works on Linux.

  • @frankroos1167
    @frankroos1167 3 місяці тому +1

    I have been looking for this for a while. Mainly for toying around and make a POC for some things that my boss won't ok, until he has a POC.
    Chances are it will even be enough for what we want to do. So if I say "Hey, no library to pay for", he'll be happy. Although, if we do end up needing a library that isn't too expensive, I can probably convince him, with some good arguments added to the POC.
    Thank you so much for pointing me in a feasable direction.

  • @JustDezz
    @JustDezz 3 місяці тому +113

    > No libraries, no nothing
    > Installs a bunch of packages

    • @qj0n
      @qj0n 3 місяці тому +18

      ...runs a script to install browser binaries on the machine

    • @mrx10001
      @mrx10001 3 місяці тому +9

      ye should change it to no paid libraries.

    • @jeremymartini1975
      @jeremymartini1975 3 місяці тому

      @@mrx10001 And so he did

    • @justinian.erdmier
      @justinian.erdmier 3 місяці тому +8

      I mean, the whole point of .NET Core was to break it up into a bunch of smaller packages instead of one giant library. Everything he installed was from Microsoft. It was pretty clear, as he kept mentioning IronPDF, that he meant third party libraries, and specifically ones that require a paid license.

    • @metalor696
      @metalor696 2 місяці тому

      @@justinian.erdmier "I meeeeeannn"

  • @irezax
    @irezax 3 місяці тому +63

    Keep in mind this will be pretty memory intensive though. For real production environments you will need something light that can also scale well. Consider using a pure library for real world scenarios.

    • @peepeefrog_
      @peepeefrog_ 3 місяці тому +12

      We are not generating PDFs in a O^2 cycle

    • @leonardoperes-so1nc
      @leonardoperes-so1nc 3 місяці тому +2

      Can you suggest me one?

    • @prman9984
      @prman9984 3 місяці тому +5

      This is exactly what I was thinking. This is VERY heavy.

    • @Washbancz
      @Washbancz 3 місяці тому +1

      ​@@leonardoperes-so1nc I'm commenting here to get notified

    • @vexxxG
      @vexxxG 3 місяці тому +4

      Since this and puppeteer load chromium it is memory intensive, but if you use it as a singleton and just instantiate playwrite once then it should be fine. But as soon as you want pdfs that are editable, contain fields or you need digital signature capability, yeah this is not gonna cut it at all, and that is when you will start paying a lot of money for a bigger library (syncfusion has one of the best licensing as far as I can tell since the community version gives you a free license until you hit like a 2million $ profit margin or something like that)

  • @rodrigo6459
    @rodrigo6459 3 місяці тому +2

    This was GREAT!! Just in time for exactly this requirement for a project I’m working on!! 👍👍

  • @chrisbaker5284
    @chrisbaker5284 3 місяці тому +6

    I use the built in PrintDocument() set its PrinterSettings object to use Microsoft Print to PDF driver (this does have the drawback of creating a temporary file though). Setting up the page is a bit tricker than using html converters, but easy enough and I have complete control of the whole process.

  • @PietervandenHombergh
    @PietervandenHombergh 3 місяці тому +12

    I have good experience using latex. Your code generates latex code, possibly using templates and then run a pdflatdx compiler as a sub process.

    • @michallevy9806
      @michallevy9806 3 місяці тому

      Yep. I use a similar approach - generating XSL-FO from templates and running Apache FOP to do the conversion to PDF

    • @tymurgubayev4840
      @tymurgubayev4840 3 місяці тому

      Just wondering: did you consider using LuaTex? And if you did, what was you conclusion?

  • @KnightSwordAG
    @KnightSwordAG 3 місяці тому +9

    Wouldn't it be just as sensible to use the MVC Razor page render engine? Aren't they ultimately the same thing?

  • @maskettaman1488
    @maskettaman1488 3 місяці тому

    If only printing were this easy! Great video as always

  • @WahidBitar
    @WahidBitar 3 місяці тому +1

    we're using puppeteer to call our frontend page by passing the access token in the query string.
    the advantage we have is the frontend team design the required document using the tools they already familiar with
    the disadvantages is the complex setup and depending on the server to have chromium and so on

  • @sonicmouse3083
    @sonicmouse3083 3 місяці тому +115

    All these "HTML To PDF" libraries suck. They all package the Blink/Chrome browser in the nuget package, so it's huge. They use the "print to pdf" implemented by blink. Needless to say, it is extremely memory and CPU intensive. Most of us will need to create thousands if not hundreds of thousands of PDFs -- This library will bring your entire server to a crawl, and you'll be paying out the you-know-what in CPU usage. Just buy a real PDF library. The cost will be a wash. Yes, this is a free alternative to these libraries, but that will be the least of your problems if you need to do real work.

    • @gahshunker
      @gahshunker 3 місяці тому +9

      At this point, just run a cmd comand to use msedge print-to-pdf functionality, just serve your html to it and that’s it. Msedge comes default with windows, so no other dependencies needed.

    • @CesarDemi81
      @CesarDemi81 3 місяці тому +7

      I was coming to say the same: at my work we had to evaluate different libs (both free and paid) and ended up deciding for QuestPdf because it was way simpler and much better performant than any of these BS html-to-pdf libs that have all the cons you mentioned. We evaluated Playwright and IronPdf as well and both ended up in the trash can.
      At some point companies have to decide to spend some money and in the context of big projects, it really is not worthy to cut down expenses on these things which can really have an impact.

    • @BamYazi
      @BamYazi 3 місяці тому +1

      @@CesarDemi81 This is almost the solution i ended up with - I use Xceed Words to generate a document (i also need to be able to save out a Word version of the PDF), use WebView2 (Edge but really Chromium under the hood) to preview the PDF in the (desktop) app - which you get for free, and then have a SaveAs word function - I have yet to find a nice solution to this - even with expensive paid libraries there always seems to be some 'hacking' involved to have a nice document output functionality

    • @jcarman
      @jcarman 3 місяці тому

      ASPOSE & ABCPDF, I'm looking at you. Such ridiculously large libraries for what they do...

    • @Feeder-fi5dh
      @Feeder-fi5dh 3 місяці тому +3

      If you want good looking, easy to maintain PDFs, using HTML templates is an excellent approach. But you will always need a browser engine if you want to use the latest CSS possibilities.

  • @haukurorsson833
    @haukurorsson833 3 місяці тому +3

    Not sure I like using Chromium to do this, but using the Razor engine to render components/models into HTML strings is brilliant, I did not think of that. I'm already creating PDFs from manually constructed HTML strings using SelectPdf. I might incorporate the Razor engine for templating. Thanks!

  • @gabynevada
    @gabynevada 3 місяці тому +2

    Packaged the same approach in the BlazorReports library, but more for a separate report server.
    This approach works great as you can leverage Blazor and other Js libraries.

    • @theCybertier
      @theCybertier 3 місяці тому +1

      Do you have any experience how this approach deals with header/footer logic, especially one time headers followed by a different repeating header? Same for footers? Also tables across multiple pages with and without their own repeating header? Those were topics previous approaches I saw to PDF generation from HTML struggled with.

    • @gabynevada
      @gabynevada 3 місяці тому

      @@theCybertier It's definitely a limitation, it's not hard to include repeating headers or footers but when you need to add logic to them it gets harder. Will try to see if I can get a usable example on the repo if it's viable.

  • @jeremiahtatro4456
    @jeremiahtatro4456 3 місяці тому

    I used to use Office apps to print to a Postscript file, then had a script that would package the Postscripts as a PDF. It was free, in that my employer used Office for everything but printing to Postscripts isn't exclusive to Microsoft products and is completely free as long as you have a Postscript printer installed.

  • @GoldenPockets2
    @GoldenPockets2 3 місяці тому

    I had to develop a project with PDF reports, and what I did is, I created a TeX template with labels like __name__, __date__, etc. So those labels were replaced with code and the result was converted to PDF. I even included some graphs with TeX libraries.
    The final software had to bundle the TeX distribution (MiKTeX if I recall correctly).

  • @modulsyd9222
    @modulsyd9222 3 місяці тому +11

    I have usel Blazor for years to create nice prints, also with pagination and booklet printing 😊

  • @Shenron666
    @Shenron666 3 місяці тому +2

    You said "no libraries", so how do you call Playwright if not a library ?

  • @burakkoprulu3504
    @burakkoprulu3504 26 днів тому

    I can not see local image on pdf? did I do something wrong

  • @Maestrou-jb1rq
    @Maestrou-jb1rq 3 місяці тому +6

    Very nice solution to render PDFs! This should also work with Selenium instead of Playwright

  • @wsidechris
    @wsidechris 3 місяці тому +2

    If you need a proper publishing infrastructure (page layouts, footnotes, overflow options), then I’ve used XSLFO for years. Similar to HTML markup with CSS. I use a simple paid library called Ibex to render it.

  • @dukefleed9525
    @dukefleed9525 3 місяці тому +3

    PupeteerSharp also allows to detect and fine control which version of browser is installed

  • @AbuBakrSadiqi-b7t
    @AbuBakrSadiqi-b7t Місяць тому

    Hello, very information video, I have one question. please answer my question
    I have a microservices architecture with 5 services, 2 of them send emails, so have different html dynamic templates in email, and other three have pdfs, .. So if i create a 6th service of blazor project, and then send requests from other services to blazor to create pdf or html (as you are showing on video), and then can download or send on email. is that a good practice? I mean at the same time blazor will be responsible for creating email template like password reset email or otp email, and also responsible as a service to send emails and print pdfs.

  • @maxsnts
    @maxsnts 3 місяці тому +2

    I/we did the same but instead of having that in the app, i did an API, you sent it a link (of the invoice) and the API returns the pdf. No overhead of installing playright/chromium on all servers, just the ones dedicated to this api

  • @dom4068
    @dom4068 3 місяці тому

    Having worked on creating pdf muliple times, the way we had done without pdf library was when the content was created in our appliction.
    If we have conver a content created by another application, that is challenging. And the PDF library based on browsers seems to be the only way. The main reason being bowsers allow lot of errors in html.
    The best way to extend the capability was to use a flow document to have the ability to fixed documet and then to pdf, which unfortunately Ms choose not to do.
    Another prospective way is to extend the print to pdf, which also can be done to a good extent, but the libraries that i explored had one issue or another.

  • @stevenj8261
    @stevenj8261 3 місяці тому +2

    Using gotenberg
    Container able to do html to pdf or word to pdf using libre Office

  • @WarrenGarabrandt
    @WarrenGarabrandt 3 місяці тому

    I was JUST looking for something like this!

  • @marna_li
    @marna_li 3 місяці тому

    I have used libraries that allow me to dynamically compile a template (int Razor syntax) that I had fetched from the database. I wanted to move over to the Razor components engine but since it lacks that support it is impossible. You kind of have to compile the templates into the project. Unless you compile components into a separate assembly, store it somewhere, and then load it when you generate the invoice.

  • @TheSilent333
    @TheSilent333 3 місяці тому +12

    I love things like this. Definitely saving this in case I need to create any PDFs. Getting my employer to shell out money for libraries is next to impossible :P

  • @_MoshikoAz_
    @_MoshikoAz_ 3 місяці тому +1

    will it work as a service for web api controller ?

  • @code8986
    @code8986 3 місяці тому +3

    Some years ago I used PDFlib to generate PDFs based on a template document and dynamically populated field values.
    I think it was a fairly expensive library and probably overkill in many cases, but it worked flawlessly, was extremely scalable, and could do pretty much anything with PDF files.

  • @matthewsheeran
    @matthewsheeran 3 місяці тому +1

    A smart alternative would be to communicate instead with, and print on, the client side with the user's browser! Equals no server side bloat or CPU.

  • @binino7684
    @binino7684 Місяць тому

    I wish I knew this about 3 years ago 🤣
    Next time I'll do it like this, but I will isolate it as a service in a container and send to an storage like s3

  • @lacuevadelinsecto
    @lacuevadelinsecto 3 місяці тому +1

    I really like this approach. I wonder if there is a way to generate the PDF using streams. For example, when there is a large amount of data that requires writing the file while the data arrives. Also, when there are many files queued to be generated.

  • @robadobdob
    @robadobdob 3 місяці тому

    We currently use the Syncfusion library. It does the job but I have been tempted to pivot to Playwright to save $$$.
    The thing I can’t see this approach doing is document assembly i.e. taking multiple PDF and merging them into one PDF with page numbering etc.

  • @KvapuJanjalia
    @KvapuJanjalia 3 місяці тому +29

    Headless Chromium? No, thanks. Not on my servers.

    • @burtonrodman
      @burtonrodman 3 місяці тому +9

      put it in a purpose built container that has NOTHING else running there.

  • @DanielRezendePessoa
    @DanielRezendePessoa 3 місяці тому

    Awesome!!! Save my life!!! Thank You!!!

  • @canabale
    @canabale 3 місяці тому +1

    Hey Nick,
    I love your videos and I'd have a wish on a topic.
    Could you please make a video about best practices on pull-requests, focussing not on the self-explanatory branch policies, but more on the perspectives of author and reviewer?
    Reason:
    We had a couple of "fights" in our company because of comments on pull-requests.
    We had these issues on multiple products, involving multiple developers and I feel like it's a systematic issue that must be addressed, before things get out of hand. I highly doubt that we are the only ones struggling with this, since pull-requests are a devops essential.
    And I am pretty sure, that someone like you, with an own "code-cop" series, has some neat hints on how to improve as both, author and reviewer, to keep such things from happening. And even if not, it would be great if you could share your experiences with this, cause then this community will very likely be able to provide decent advice.

  • @CuriouslyContent
    @CuriouslyContent 3 місяці тому +5

    A lot of people are commenting that this would crush server performance and/or cost a ton of money. That assumes the reports are being generated on the server and that you are in the cloud. In some scenarios that is unavoidable. But many other scenarios this solution would work well.
    For Desktop apps, this would be great (can everything Nick did can be baked into the desktop app and just send the data to the client and have them render it?).
    With the web, well, you are already rendering to HTML, so you can just have the client export to pdf from his/her browser.
    So really the only scenario where this would be an issue is if you were a company offering a pdf-generating service to clients. Then you do have the possibility of millions of pdfs being generated in a short amount of time (if you have a large client base). But if you are a company generating invoices for your clients in-house, then this would absolutely be a viable solution.

    • @NikaTark
      @NikaTark Місяць тому +1

      The point of PDFs is that you can lock editing and sign it, which is crucial for invoices or other legal documents.
      You lose that when you ask client to export the html page to a pdf, them being free to edit any fields before doing so.

  • @themikeporter
    @themikeporter 3 місяці тому

    Nice, I like it. On desktop apps, I use WPF with Xaml in code to print to the Microsoft PDF driver. I've created some very complicated products with drawing and graphing with complete pagination.

  • @sunindragupta9236
    @sunindragupta9236 2 місяці тому

    Hi Nick, trying to convert a Html to pdf. When done via Chrome browser it's perfect, all the images and page breaks are perfect, I need to do it via azure function, please advise

  • @StackMJ
    @StackMJ 3 місяці тому

    How fast is it in comparison to Rotativa?

  • @prashantmahajan8584
    @prashantmahajan8584 Місяць тому

    Can we create pdf/a through this?

  • @LouisDuran
    @LouisDuran 3 місяці тому +1

    Weird on the timing of this.... I was just adding save to PDF support in a WPF application I'm developing for a client. Unfortunately I can't see a way to integrate this solution into a WPF application.

    • @coloresfelices7
      @coloresfelices7 3 місяці тому +1

      In a WPF application I developed years ago, I created XPS files and called GhostScript to convert them to PDF. Has the advantage that, for creating XPS, I can re-use all WPF UI components.

    • @LouisDuran
      @LouisDuran 3 місяці тому

      @@coloresfelices7 ok. I'm sort of doing the same. Rendering WPF Visual element into XPS format, then using PDFSharp to convert that to PDF. The problem is the Visual element is a scroll viewer and I want to have it render the entire content not just what's visible. I need to do more research...

  • @Mr767267
    @Mr767267 3 місяці тому

    Thanks for sharing. Does it have capability to protect PDF, sign PDF too?

  • @StephenMoreira
    @StephenMoreira 3 місяці тому

    Very interesting. Will check it out for my project.

  • @techwatching
    @techwatching 3 місяці тому

    I like the open source library Quest PDF (there is a commercial licence also, but the price is okay).

  • @thebrandseagle
    @thebrandseagle 3 місяці тому

    Can we do similar in a blazor web assembly application?

  • @TreeLuvBurdpu
    @TreeLuvBurdpu 3 місяці тому

    I use Pandoc. You can also call it from the CLI.

  • @microtech2448
    @microtech2448 3 місяці тому +3

    Will this work on azure app service?

    • @umair_me
      @umair_me 3 місяці тому

      This is my question too. if anyone has tried let us know?

    • @KhaUh
      @KhaUh 3 місяці тому

      @@umair_me i had someone said to me that it would work but i never tried it

  • @nickw656
    @nickw656 2 місяці тому

    will the code be run on Linux without GUI?

  • @rupture007
    @rupture007 3 місяці тому

    I use just html file with scriban for templating to replace the placeholders. Then IronPDF for the pdf generation. It works well, but I want to try this now.

    • @rupture007
      @rupture007 3 місяці тому

      seems like it would be easy for me to swap out IronPDF and try this since I already have a string for the html that I pass to IronPDF. I'll report back if it works. The html has chartjs-umd in it and some data points to make some charts. Should be interesting to see if that works with Playwright

  • @davidepotocnik4838
    @davidepotocnik4838 3 місяці тому +2

    Hey....but in the containerized era there is the Gotenberg

    • @DClearEE
      @DClearEE 3 місяці тому

      Playwrite and gotenberg both look like they use headless chromium to create PDFs. You just containerize playwrite and have it basically be the same thing

  • @petropzqi
    @petropzqi Місяць тому

    The mail function does not work. I don't get the source code...

  • @agmiddles
    @agmiddles 3 місяці тому

    This was a great and creative solution.

  • @petrgrebenicek1067
    @petrgrebenicek1067 18 днів тому +1

    How about PDFSharp & MigraDoc by empira Software GmbH, Germany
    It is open source under MIT licence
    Edit: they are still working on it, but basic functions didn't changed for years so you can AI simple PDF quickly

  • @devgenesis6436
    @devgenesis6436 3 місяці тому +1

    I have used pupeteer and print pdf to generate hundreds of pdf the code runs in lambda and step functions so server handling was never a chay

    • @TimmyBraun
      @TimmyBraun 3 місяці тому +1

      Same. I generate statements for a company using PuppeteerSharp and create and email almost 300 files in less than 4 minutes. Some of the querying and emailing also takes time so... do the math. Not a bad deal for me.

  • @JustinChasez04121990
    @JustinChasez04121990 3 місяці тому

    Would love to see if you can Dockerize this solution. I have tried and it failed. Maybe I did something wrong?

  • @RicusNortje
    @RicusNortje 3 місяці тому

    I still live JS Report. Can slef host and get 5 free templates which can be more than enough if used cleverly

  • @DanteDeRuwe
    @DanteDeRuwe 3 місяці тому

    This is actually a very interesting approach to be able to do SSG with Blazor! Experimented with it before and although it's rudimentary; it does the trick. I did not think of the use case of creating pdfs though, very interesting!

  • @BamYazi
    @BamYazi 3 місяці тому

    This is a pretty cool solution (i love using the Razor html renderer in a non browser app - already got me thinking of other uses for that), although this solution is also pretty 'expensive' because of the dependency on Playwright which means including Chromium etc which are pretty large dependencies. Personally i use Xceed Words to generate documents Word/PDF which isn't as nice in terms of the code needed to create the document, but a bit more lightweight (and very cheap compared to most of the paid document generation libraries).

  • @TewodrosAAssefa
    @TewodrosAAssefa 3 місяці тому +5

    What is the resource usage like?

    • @gabynevada
      @gabynevada 3 місяці тому +5

      @@TewodrosAAssefa you can make it pretty efficient by skipping play right and controlling the chrome instances directly.
      You can make it so that you stream the report from the chrome instance to the Response body without having to buffer the entire pdf in memory using pipes.
      Been generating tens of thousands of reports daily on a container with 1 vCPU AND 1GB of RAM.

    • @ВладиславДараган-ш3ф
      @ВладиславДараган-ш3ф 3 місяці тому +2

      @@gabynevadait’s still freaking Chrome dude, it’s a horrible idea

    • @marcelfiechter7436
      @marcelfiechter7436 3 місяці тому

      @@gabynevada This sounds great. I try to find out how this works. I save the Chromium binaries on my device. Then I probably start with ChromiumDirectory = "C:\Users\Me\DotNetBrowser" and create the EngineFactory. What is the key-line to get the pdf finally in the Response body?

    • @gabynevada
      @gabynevada 3 місяці тому

      @@ВладиславДараган-ш3ф right now other forms of generating PDFs are very limited, if you need the flexibility then a browser is one of the best ways to do it.
      Hopefully other options will keep growing and we can avoid it in the future.

    • @marcelfiechter7436
      @marcelfiechter7436 3 місяці тому +1

      @@gabynevada That sounds great. But I don't understand where the conversion to pdf is?

  • @Zhum22
    @Zhum22 3 місяці тому +1

    Very nice! But do you have to install the browser on the computer for this to work?

  • @faisalalhoqani6151
    @faisalalhoqani6151 3 місяці тому

    In my case, I am using RDL through the .NET Framework API to get PDF or Excel for my .NET Core application.

  • @Kingside88
    @Kingside88 3 місяці тому

    Man this is amazing.
    I still love the good old way using rdlc to generate pdfs.
    But I guess this way is also kind of ok

  • @sergeyz.5845
    @sergeyz.5845 3 місяці тому +11

    Let's do the no external libraries app challenge!

  • @sodreigor
    @sodreigor 3 місяці тому

    Hey Nick did you ever have to read pdfs programmatically? Which lib did you use in that case?

  • @Alguem387
    @Alguem387 3 місяці тому

    Reminds me of the time i serializeda object to json to then transform said json into xml becuase the xml library did not support DateOnly and TimeOnly structs

  • @awright18
    @awright18 3 місяці тому

    Regardless of the implementation, I really like the idea of generating PDFs from HTML because average developers can do it.

  • @stati5tik
    @stati5tik 3 місяці тому +2

    Nice, now show the memory consumption.

  • @kamau6988
    @kamau6988 3 місяці тому

    Very timely video

  • @eyu6652
    @eyu6652 3 місяці тому

    Question. Can you include tailwindcss or bootstrap css?

  • @vernonjacobs7140
    @vernonjacobs7140 3 місяці тому

    @nick does this work with something like bootstrap,etc

  • @Kirill-l7c9y
    @Kirill-l7c9y 3 місяці тому

    WOW! Realy cool. I am afraid that IronPdf has ordered you after it

  • @santiagocalgaro2486
    @santiagocalgaro2486 3 місяці тому +3

    I had a really hard time containerizing libraries that convert HTML code to PDF because they usually rely on Windows packages. Can this one run on Linux?

    • @goldfinger490
      @goldfinger490 3 місяці тому +2

      yes

    • @JohanBenschop
      @JohanBenschop 3 місяці тому +1

      We have done a very similar thing to Nick's shown here, and it has been running in production for a while now on the smallest Linux Azure Container App they have.

  • @djupstaten2328
    @djupstaten2328 3 місяці тому

    What would happen if I use just any html as my HtmlString and run it through Playwrite and PdfAsync ?

    • @jeffreykleine871
      @jeffreykleine871 3 місяці тому

      The same, it will just render the html through chromium and use it's pdf function.

  • @davidjackson148
    @davidjackson148 3 місяці тому

    first question, why do i need blazor?

    • @raduban2029
      @raduban2029 3 місяці тому

      You don't. You just need a way to use the Razor view engine to generate HTML as a string from Razor views. It works equally well with MVC, I've been using it for 10+ years in production with the IBEX xsl-fo processor (paid for, equivalent to Apache fop)

    • @davidjackson148
      @davidjackson148 3 місяці тому

      @@raduban2029 just wondered why it was in there if you don't need it, just seems to complicating a simple concept for the sake of it

  • @alissoncandatem1896
    @alissoncandatem1896 3 місяці тому

    I need to digitally sign PDFs, but I'm not sure where to begin or even if it's possible to do that with this but i'll give it a try

    • @sarcasticMoose
      @sarcasticMoose 3 місяці тому

      Firstly you have to get a certificate (need to buy it) and the signing tool.

    • @alissoncandatem1896
      @alissoncandatem1896 3 місяці тому

      @@sarcasticMoose I do own a certificate and can technically sign it I just need to add it visually into the pdf itself.

  • @varmelot
    @varmelot 3 місяці тому

    Paid PDF libraries is not only about create PDF document. It's about manipulate Signatures and aForm data

  • @sacalbal
    @sacalbal 3 місяці тому +1

    What about itext ?

    • @neilbroomfield3080
      @neilbroomfield3080 3 місяці тому

      Not free, well maybe very old versions.

    • @fusedqyou
      @fusedqyou 3 місяці тому

      @@neilbroomfield3080 It's free for personal use, not application releases I believe.

  • @sulmarpl
    @sulmarpl 3 місяці тому

    Can this generation method be used on a docker?

    • @sakesun
      @sakesun 3 місяці тому +1

      You will have to use Debian based image as required by Playwright. Other Linux is not supported by default.

    • @sulmarpl
      @sulmarpl 3 місяці тому

      @@sakesun Thank you for hint. I found a image linuxserver/chromium.

  • @AslamNazeerShaikh
    @AslamNazeerShaikh 3 місяці тому +3

    Please make more PDF manipulation videos

  • @Rajeshsingh-ws5th
    @Rajeshsingh-ws5th 3 місяці тому

    HTML to pdf is good for just learning and basic PDF file. need to do lot of changes when it comes to create slightly complex document.

  • @bobvanzuilen9366
    @bobvanzuilen9366 3 місяці тому

    The problem that I have with generating PDFs from HTML is that I want each and every page of the document to contain a caption at the top of the page, regardless of the length of the document. How would I reach that goal with a HTML based PDF generator like Nick's solution?

    • @cjb110
      @cjb110 3 місяці тому

      PDF's have a header concept, and I think you could see in the video that there were methods for manipulating/setting the header.

    • @BamYazi
      @BamYazi 3 місяці тому +3

      Wait until you want to have multi page tables with repeating headers ;)

    • @bobvanzuilen9366
      @bobvanzuilen9366 3 місяці тому

      @@cjb110 thanks, will try, but my experiences with other packages are ..... Quite underwhelming. Problems usually arise as @bamyazi said.

    • @raduban2029
      @raduban2029 3 місяці тому

      For complex layouts you need an xsl-fo processor like IBEX (commercial) or Apache FOP (foss but written in Java)

  • @andersborum9267
    @andersborum9267 3 місяці тому +1

    Are the PDFs UA compatible?

    • @stephanf17
      @stephanf17 3 місяці тому

      ^^ + I am always missing an option to add a data layer (as you'd need to create most of eInvoice formats).

  • @samuelschwager
    @samuelschwager 3 місяці тому

    nice clean solution

  • @vbachris
    @vbachris 3 місяці тому

    i did something like this a few years ago for email templates

  • @Senadtm87
    @Senadtm87 2 місяці тому

    Same as PuppeterSharp, using browser and will cause issues when creating large size pdfs.

  • @sergeynosov8180
    @sergeynosov8180 3 місяці тому +3

    The other problem with HTML to PDF is pixel-perfect rendering for intricate work (such as exact positioning on pre-cut labels) and bleeds. You do not always need pixel-perfect rendering, but when you do, HTML just does not cut it.

  • @PratikPanchal-tp8dp
    @PratikPanchal-tp8dp 2 місяці тому

    Awesome !!!

  • @arjunmenon2901
    @arjunmenon2901 3 місяці тому

    What is your take on IronPdf ?

    • @adds-kz3oc
      @adds-kz3oc 3 місяці тому +4

      It's paid.

    • @arjunmenon2901
      @arjunmenon2901 3 місяці тому

      @@adds-kz3oc oh yeah. We have perf issue with ironPDF in Linux servers. Have been searching for an alternative solution.

  • @piotrmilotrojan
    @piotrmilotrojan 3 місяці тому +2

    Does this work in no GUI environments? Like VPS or some Bash only linux installation?

  • @rmcgraw7943
    @rmcgraw7943 3 місяці тому

    If you specify the Content-Type for a PDF or XLS, or whatever, then stream (Response.Write) the content you want in your file (for an XLS spreadsheet, just stream out a ), after the browser has received the file data, you can go File, SaveAs, and that file type will show as an optional file format, assuming your operating system has that file type registered as a known file type. There is no overhead on the server, and the tiny bit of processing done is done on the client.

  • @MatinDevs
    @MatinDevs 3 місяці тому

    9:09 Nick just violated Apple

    • @deado7282
      @deado7282 3 місяці тому

      No, he violated Safari. Because it's just the worst piece of sh**.

  • @eloyrolandocanchanyabalbin4692
    @eloyrolandocanchanyabalbin4692 3 місяці тому +1

    About excel?

    •  3 місяці тому

      ClosedXml might be the best one right now to generate Excel. EPPlus is no longer free. NPOI seems to be used a lot, but if you go back in the history, it was at some point filled with political statements (both on NuGet and GitHub), so I am not sure if I would trust that one.

  • @charlesaboujawdeh
    @charlesaboujawdeh 3 місяці тому

    I'm thinking Selenium might have the same functionality as Playwright?

    • @nickchapsas
      @nickchapsas  3 місяці тому

      Not sure. I thankfully haven’t used Selenium since Playwright came out

  • @Coco3l
    @Coco3l 3 місяці тому

    Somebody was on vacation 🏖🏖🏖

  • @coreysteinwand
    @coreysteinwand 3 місяці тому +3

    This is cool, I wonder if we can use this library for qr codes / barcodes for a label printer