Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello Sir,

I am working on a Asp.net MVC4 application in which I am required to generate the PDF document of the individual users bill. I am fetching the data from the database and in my Action Result I am getting the data from the model and want to generate the view as PDF and also want to design the layout.
1. So Simply I want to generate my view data in PDF coming from model(Database) in a list?
2. Is there any problem in generating the PDF containing huge records?
3. How do I design my bill format, can I use DIV and CSS to accomplish the task?

Please help me

Thanks & Regards
Amardeep Singh
Posted
Updated 7-Sep-14 20:17pm
v2

1 solution

Returning a file from MVC is not the same as returning a view. Your best bet is often to return it as a FileContentResult() or File() and let the user decide what to do with it. This also migrates any issues they might have viewing it in the browser, in case PDF extensions are turned off or not installed.

1. The Database is not your model, you table schema is. Get the relevant (to that customer) information and pass it to whatever you're using to parse into PDF.

2. If your having individual customers downloading their individual records, you will see slowdown if you have several doing so at the same time. I can't guess at the performance hit, you'll need to load test to determine that. Otherwise, it's a standard query where output is simply redirected to a PDF parser rather than a view.

3. This is wholly contingent on the PDF parsing mechanism that you choose (or write).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900