CSHTML form to PDF File.
So i have some form in my cshtml view that saves all the data correctly inside the corresponding model, and i need to get these input data and display them inside a pdf file. I tried using QuestPDF, DinkToPDF and BouncyCastle methods and none really worked.
This is the project : "https://github.com/GentiOsmani/DeklarimiPasurise"
So the forms are filled inside this directory : "DeklarimiPasuris>Views>Declare>Create.cshtml".
They Are saved at this directory : "DeklarimiPasuris>Models>DeclarationModel".
And they are shown at this directory: "DeklarimiPasuris>Views>Declare>Details.cshtml".
The pdf should download when this button is clicked : "<td><a class="btn btn-primary" asp-action="DownloadPdf" asp-controller="Declare">Shkarko</a></td>" (line 38),
Inside of this directory : "DeklarimiPasuris>Views>Declare>Index.cshtml".
If someone could help me it would be a blessing.
Best Regards, Genti.
7 Replies
What didn't work in the aforementioned PDF libraries?
@Gramore i kept getting some bouncy castle errors when i executed the code
even tho i installed all the right packages and tried it 100 times in all different ways
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
I assume that QuestPDF wasn't giving you bouncy castle errors for example, and it would be a lot easier to help fix whatever bouncy castle error you're getting if you listed it explicitly
@Gramore let me see if i can find that error 1 sec
this was it i think
Kewl, so do you have either of those dependencies added? presumably this: https://www.nuget.org/packages/itext7.bouncy-castle-adapter/8.0.1
itext7.bouncy-castle-adapter 8.0.1
Bouncy-castle adapter module