Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
Im using report viewer to to create a report in my application it creates perfectly and fits snuggly in one page but when i convert it to pdf and email it, it gets spread over 4 pages when viewed by a client who's recieving it.

C#
Warning[] warnings;
            string[] streamids;
            string mimeType;
            string encoding;
            string extension;
            byte[] bytes =ReportViewer1.LocalReport.Render("PDF", null, out mimeType,
            out encoding, out extension, out streamids, out warnings); //converting into pdf
            MemoryStream s = new MemoryStream(bytes);
            //s.Seek(0, SeekOrigin.Begin);
            Attachment att = new Attachment(s, file);
            SmtpClient smtp = new SmtpClient("pod51014.outlook.com");
            MailMessage msg = new MailMessage();
            msg.Subject = "Invoice Report";
            msg.From = new MailAddress ("209@dut4life.ac.za");
            msg.To.Add(get_Email());
            msg.Attachments.Add(att);
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.EnableSsl = true;
            smtp.Credentials = new System.Net.NetworkCredential("209@dut4life.ac.za", "Dut920925");
            smtp.Port = 587;
            smtp.Send(msg);

I suspect that it gets ruined during my conversion to pdf

thanks in advance regards
Posted
Comments
Richard MacCutchan 29-Sep-12 5:13am    
I suspect that it gets ruined during my conversion to pdf
And exactly how are we supposed to guess what happens during this conversion? Please edit your question and show the information relevant to your question rather than the code that sends the email.
HackensackNJ 29-Sep-12 6:53am    
You might want to change the password of that email right about now.
Is this sql report or crystal report?
mlingo209 29-Sep-12 11:14am    
I thought this "byte[] bytes =ReportViewer1.LocalReport.Render("PDF", null, out mimeType,
out encoding, out extension, out streamids, out warnings);" Is where it gets converted I'm sorry this is copy and paste, lmao the Passwords is correct its the username that is totally off hahahah and yeah I think it is sql reports it uses controls found within the Visual Studio 2012

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900