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.
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.
“The function of good software is to make the complex appear to be simple.”
(Grady Booch)
Well if you go through the manual section of http://www.asppdf.com/ you will probably know how to convert your aspx pages into pdf , you can use a trial version to check to see if your desired req r achieved or not.
“The function of good software is to make the complex appear to be simple.”
(Grady Booch)
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.
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.
“The function of good software is to make the complex appear to be simple.”
(Grady Booch)
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.
“The function of good software is to make the complex appear to be simple.”
(Grady Booch)
Member
3 Points
10 Posts
Create a PDF of a Web page and Mail it
Feb 23, 2011 06:21 PM|austinadi|LINK
Hey guys,
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.ClearHeaders();
Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".pdf");
Response.Charset = "";
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/pdf";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
form1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Pls help thank you guys,,,
Participant
1480 Points
593 Posts
Re: Create a PDF of a Web page and Mail it
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
PDF
iText Examples
and plz let me it solves you problem or not
Custom watermark on PDF
Thanks and Regards
Ravi Mathpal
All-Star
78951 Points
16373 Posts
Re: Create a PDF of a Web page and Mail it
Feb 23, 2011 06:55 PM|ramiramilu|LINK
http://www.mikesdotnetting.com/Category/20
JumpStart
Member
3 Points
10 Posts
Re: Create a PDF of a Web page and Mail it
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
Thanks,
Aaditya
Member
30 Points
87 Posts
Re: Create a PDF of a Web page and Mail it
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.
(Grady Booch)
Member
3 Points
10 Posts
Re: Create a PDF of a Web page and Mail it
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.
Thanks again,
Adi
Member
30 Points
87 Posts
Re: Create a PDF of a Web page and Mail it
Mar 04, 2011 12:35 PM|creative3k|LINK
(Grady Booch)
Member
3 Points
10 Posts
Re: Create a PDF of a Web page and Mail it
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.
Thanks,
Adi
Member
30 Points
87 Posts
Re: Create a PDF of a Web page and Mail it
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.
(Grady Booch)
Member
30 Points
87 Posts
Re: Create a PDF of a Web page and Mail it
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.
(Grady Booch)
Member
3 Points
10 Posts
Re: Create a PDF of a Web page and Mail it
Mar 07, 2011 04:43 PM|austinadi|LINK
Got it fixed..
Thanks for the help.
Adi
Member
30 Points
87 Posts
Re: Create a PDF of a Web page and Mail it
Mar 08, 2011 05:20 AM|creative3k|LINK
Mark as answer and close the post by changing its status to resolve
(Grady Booch)