Last post Mar 08, 2011 05:20 AM by creative3k
Feb 23, 2011 06:21 PM|austinadi|LINK
I have a situation here and I am struggling to overcome it for the last 2 days.
I have a ASP web page which takes input from the user and stores the values.
I want to convert the webpage once the user fills in the form into a PDF file with these values and I wanna attach the PDF to the mail.
I av problems converting the web page into a PDF file, can any 1 help me with some code snippet on doing this, I surfed the whole internet and nothing really actually worked or created PDF that said could not open..
I will attach the code that I av written inside a button click event, this code generates the PDF but it cannot be opened as it says wrong format..
Help me on how to attach the created PDF to the mail, where I have used the Outlook mail calling it with mailto function.
Hope some1 finds my prob a piece of cake.
I used the Itextsharp
protected void Button3_Click(object sender, EventArgs e)
string filename = "Customer";
Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".pdf");
Response.Charset = "";
Response.ContentType = "application/pdf";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
Pls help thank you guys,,,
Feb 23, 2011 06:50 PM|RaviSM|LINK
Do u want to convert the whole web page or the value entered by the user only
and plz let me it solves you problem or not
Feb 23, 2011 06:55 PM|ramiramilu|LINK
Feb 24, 2011 09:41 AM|austinadi|LINK
I want to convert the entire Web page along with the values entered by the USER... Wat you see is what I should get :P
Mar 04, 2011 08:45 AM|creative3k|LINK
I ahve done this in one of my clients project, I ahve used a third party aspPdf conversion , and grab the data and images onto pdf, you can also use existing pdf template and fill the data on it. After conversion process you can easily save it on ur local/server
drive and then using system. mail send it to the specific client/customer.
Mar 04, 2011 11:47 AM|austinadi|LINK
Hey thanks for your reply, Can you share a code snippet which would be usefull, I am really breaking my head over this.
Mar 04, 2011 12:35 PM|creative3k|LINK
Mar 04, 2011 04:57 PM|austinadi|LINK
I did try but it is just capturing the initial page without the user input. I am guessing since the changes are made only in the client side it is not actually taking the user input.
How did you go about this.
Mar 07, 2011 05:24 AM|creative3k|LINK
Well my scenario was totally different, I just need to capture the summary field of specific pages nd I got usercontrol for the footer which has an email option, so for each page if the client want the summary of that page, on d back hand it will create
the summary inlcuding images calender depending on what client has worked on it , generate pdf nd then email it automatically. I have got a database which saves information for each client, therefore whenever a client logs in , the pdf's are created by injecting
their information from the db on pdf's, and capturing their email address , finally sending email.
The converter is quite expensive, if you are experimenting for your personal use , go nd check for ny open source one , but if its for company purpose , let them pay for it,
Regarding Client side , I am not sure, if asppdf offers client side capturing, i guess what you should do is make a default template of ur aspx pages in a pdf format, and then save the client side activities on a database, then use that default pdf template's
and print the client's activity on the default pdf. There myt be ways of acheiving this, I cant think of any other way ryt now.
Mar 07, 2011 04:43 PM|austinadi|LINK
Got it fixed..
Thanks for the help.
Mar 08, 2011 05:20 AM|creative3k|LINK
Mark as answer and close the post by changing its status to resolve