Rank: Newbie Groups: Member
Joined: 3/24/2014 Posts: 1
|
Hi,
I'm trying to use EO product. What I need is that after a form is filled out, a button is pressed, the html form needs to be rendered to pdf and to be sent in an email.
Is it possible with EO, if yes, how?
I've successfully done this two things:
1. Made the page turn into PDF while visiting the page. (blocks the default functionality of the page) 2. Made a button that convert the page to pdf (using EO.Pdf.HtmlToPdf.ConvertUrl('')) - but the form fields are empty...
any suggestions?
tnx
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, You will want to use ASPXToPDF (if your application is WebForm based) or MVCToPDF (if your application is MVC based) for such cases. See here for more details: http://www.essentialobjects.com/doc/4/web/aspxtopdf.aspxhttp://www.essentialobjects.com/doc/4/web/mvc.aspxIn your case, since you do not want the PDF file to send to the client, you can take a look of the "Save Conversion Result into a File" section in both of the above links. You can either save the result into a physical file, then email that physical file; Or call Save with a MemoryStream to get a byte array and then email that byte array as attachment. This way you do not need to create a physical file on your server. The code to save the result as byte array would be something like this:
Code: C#
//Create a new MemoryStream
MemoryStream ms = new MemoryStream();
//Save the result PDF file to the MemoryStream
result.PdfDocument.Save(ms);
//Get the PDF file data
byte[] pdfFileData = ms.ToArray();
Hope this helps. Thanks!
|