I have a view/page with a form on it which is rendered using
ASP.Net MVC 4.5.1 and Razor
Bootstrap 3
I would like to be able to render a pdf snapshot of the printable view of the page as soon as the user submits the form, and save the pdf snapshot to the server for auditing purposes.
At the very least, if PDF is not possible, I should be able to render an html view, using the data that has just been submitted, and save it to disk (in .html format, for instance).
Any ideas on how I can achieve this?
Rotativa is pretty easy to use for creating a PDF view of what you want. It can be designed as a view on its on which you can access through any other view by creating an #Html.ActionLink.
Related
I have a big ASP.Net forms application. I am trying to start adding MVC for new stuff.
But still there are summary pages (in ASPX) where multiple user controls are displayed.
SO I need to embed HTML output of mvc partial page (added as area in existing asp.net web forms app) to ASPX page where other forms user controls are displayed
One way is to get HTML in code behind by initiating http request and place it in literal control.
Other approach i thought was to use JavaScript, but that may not work with convert to PDF etc scenarios.
Please suggest if there is a better way..
Thanks,
Rahul Jain
I need to implement some, let's call it "dialog" in some old ASP.NET project that I took over. It's huge project so I'm not allowed to implement new things.
I have a form on which user can attach up to 3 file attachments, enter some 10-15 fields, and when required fields are filled, submit button get's enabled.
What need to be done is press submit, wait for any possible response for server, and then display some sort of dialog, alert, lightbox which would display short summary and list of correctly uploaded files.
What would be the best approach to do this in ASP.NET?
Considering jQuery Lightbox is designed for overlaying images rather than HTML I would recommend using FancyBox or FaceBox instead.
I want to use "NVelocity" from plain ASPX pages without using any MVC framework. I don't want to use "NVelocity View Engine" thru' asp.net MVC framework. The only example that I got for "NVelocity" is for merging and writing onto console window (http://www.castleproject.org/others/nvelocity/usingit.html)
I am looking out for example on to integrating "NVelocity" into aspx web forms. Any pointers would be really helpful.
I found a way. The idea is the override Page.Render() method in an aspx page. Write the code in Render() method to transform the HTML template (I mean, *.html file or *.aspx file) using NVelocity. Pass HTMLTextWriter object while merging the template and context "template.Merge(context, writer);"
This will render the transformed HTML to web browser.
I'm developing an ASP.Net MVC2 project. What I need is that I want to print the view when user clicks a link.
You could use Javascript on a link
Print
In combination with the answer from #M.Shuwaiee you can also take advantage of creating a style sheet specifically for the printer so your view can render more accurately for a paper layout.
http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml has some information on this.
Hi ive got an mvc form with a fileupload functionality. Ive got an action that accepts an file and extracts thumbnails from it, after which the user can select the images and then proceed to submit the form. How can post the initial file via ajax, bearing in mind, this is not the final submission on the form and I want to retain user input. ie no postback
Thanks
I use the ajaxupload plugin for jQuery. Lots of sample code is provided on the site. From the site:
[The] plugin creates invisible file input on top of the button you provide, so when user clicks on your button the normal file selection window is shown. And after user selects a file, plugin submits form that contains file input to an iframe. So it isn’t true ajax upload, but brings same user experience.
Browsers don't allow the uploading of files via ajax. There are several good workarounds, however.