asp.net mvc - MVC ASP .NET - Generating PDF file -


i have c# application in mvc 4 , asp.net.

what want do, push button in razor view, sends model controller. here want create pdf-file , return view. user can save or open pdf in browser. not want save file on server, memory only.

i have tried google find examples of this. come lot itextsharp. can't find examples of code show need.

the pdf created of data model. need change fonts , size of fonts + place these want in pdf-file. need place photos (logo) @ top or bottom.

there button sends file persons email. great if re-use code that.

does have libraries or examples of how this?

in advance thanx.

edit: after lot of googling, found example strip down can use. have tried single line of text, think can build on need. @ least able change fonts. must see if can place content want. here code create file user can save on device:

    public actionresult createpdf()     {         memorystream workstream = new memorystream();         document doc = new document(pagesize.a4);         pdfwriter.getinstance(doc, workstream).closestream = false;         doc.open();          paragraph p = new paragraph("this text in file");          doc.add(p);         doc.close();          byte[] byteinfo = workstream.toarray();         workstream.write(byteinfo, 0, byteinfo.length);         workstream.position = 0;          return file(byteinfo, "application/pdf", "file.pdf");     } 

i not clear on want achieve have done use tables have formatting , add content in cells accordingly. if table not visible hid border. can find tutorial on here: http://www.mikesdotnetting.com/article/86/itextsharp-introducing-tables


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -