Click here to Skip to main content
15,891,423 members

Why is my report getting spread to 4 pages when it can easily fit on one

mlingo209 asked:

Open original thread
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
Tags: C#

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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