Solved

read data and convert to pdf and send via mail

Posted on 2014-02-15
4
522 Views
Last Modified: 2014-02-25
HI,

I am doing one functionality,its look like that i have to read some data from sql server DB ,read that data and convert in PDF file once pdf create send to via mail in one shot.

code in asp.net and c#

could you please provide the guidance or code how do i perform it in one function.

db--->read data--->convert data as a report in pdf--->send that pdf to client via mail
Thanks
0
Comment
Question by:nicemanish
4 Comments
 
LVL 16

Assisted Solution

by:Surendra Nath
Surendra Nath earned 250 total points
ID: 39861543
step 1: Connecting to Database and reading data from DB

you have to use a odbc or SQLconnection to get the data from DB, you can follow the below example for the same.
http://www.dotnetperls.com/sqldatareader

Step 2: write the data to a PDF file...

.NET natively does not support writing to a pdf file, you have to use a third party library which are publicly available.

The below is a library which can help you in writing to pdf file... how to use it and all with examples are also given in the same url.

http://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library

Step 3: Send that via e-mail as an attachement.

Follow the below link on how to send that using an e-mail
http://www.mattvanandel.com/842/c-sending-an-email-with-an-attachment-via-form/
0
 
LVL 16

Assisted Solution

by:Easwaran Paramasivam
Easwaran Paramasivam earned 200 total points
ID: 39861564
Yes. It is possible. Instead of file content save file physical file path (it could be network path).

Ensure that you have the read/write permission to the shared path.


Write code to attach the file and send as email. Refer below one for that:

http://www.codeproject.com/Questions/634878/Send-email-with-Attachment-in-Csharp
0
 

Accepted Solution

by:
mokaid83 earned 50 total points
ID: 39861605
well . if you want this could be done using php
you can check the following links , i used these libraries in many projects

PHPMAILER
https://github.com/Synchro/PHPMailer


PDF
http://www.fpdf.org/

very simple and easy to use
if you need further help .. just let me know
0
 

Author Closing Comment

by:nicemanish
ID: 39885385
good
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question