dodyg / practical-aspnetcore

Practical samples of ASP.NET Core 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mini App for Printing in PDF

dodyg opened this issue · comments

This is a common task that many people will find useful.

Is the idea something like:

Lets say we create a page which shows an Invoice (with some header, footer, and then line items)
Click a button on the page which says "Print"
A controller prepares the PDF and sends it to the browser as FileResult

??

Yeah - this is a very popular problem

This looks like a good library to use https://github.com/rdvojmoc/DinkToPdf

@dodyg there are many packages for this scenario :) per se this is not the framework/platform ASP.NET core problem. What i mean is - asp.net core out of the box has not ( should not) provided any PDF related things and thats by design. PDF creation is outside of Web framework. So there are many 3rd party packages available and if one needs PDF capability - its left to them to carefully study the packages and use the one which suits them.

My idea is to just create 1 or 2 examples showcasing couple of packages. Then the users get the idea of how to do this - and pick up whatever package they are comfortable with.

I have created 1 sample using GemDocument.Pdf - its an OSS package.
Now looking into rotativa - https://gunnarpeipman.com/aspnet-core-pdf/

This looks like a good library to use https://github.com/rdvojmoc/DinkToPdf

As a general direction for this repository, what do you think of samples that use third party libraries?

@Kralizek good question. i will leave it to @dodyg.

Personally - i would like to stick to what the framework has to offer in this Practical ASP.NET Core repository. If we start putting examples of 3rd party libraries - we may see a flooding of examples from community members. Just my opinion here.

i will wait to hear what @dodyg has to say.

there are many packages for this scenario :) per se this is not the framework/platform ASP.NET core problem.

Every ASP.NET Core web developer working in business domain will encounter this scenario. Creating samples of other projects within .NET OSS community is fine as long as it related to the domain of web development.

My idea is to just create 1 or 2 examples showcasing couple of packages. Then the users get the idea of how to do this - and pick up whatever package they are comfortable with.

Perfect.

As a general direction for this repository, what do you think of samples that use third party libraries?

We have samples for OrchardCore, CoreWCF, Orleans - they are not part of ASP.NET Core framework but they are relevant. Samples for third party libraries are welcome as long as they are open source and relevant to web development (defined broadly).

Understood

It will be brilliant for example if we have section for EntityFramework or Dapper because I mean, most web development would require database access at some point. It's missing so far simply because I don't use them. It will also take a dedicated work to cover this topic properly.

I am barely able to keep up with the ever growing .NET web related surface APIs and we haven't even touched identity/authorization/security APIs.

Interesting to me , Can i take this opportunity and create a mini app which prints just PDF using puppeteer-sharp ?

@shaijut go for it, it's yours.