I am using telerik reporter and I have set my background image with following code:
this.Style.BackgroundImage.ImageData = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(emzaUrl));
When I run the project, background image is not shown in printpreview mode but when I hit print button in reportviewer the background will appear ... I want to show background in print preview mode to allow user to decide what background should he/she use... what is the problem with print preview mode?
I had set background manually through properties window but the problem exist yet...
Answer: I used water mark at last:
Telerik.Reporting.Drawing.PictureWatermark pictureWatermark1 = new Telerik.Reporting.Drawing.PictureWatermark();
pictureWatermark1.Image = "http://www.telerik.com/images/reporting/cars/NSXGT_7.jpg";
pictureWatermark1.Position = Telerik.Reporting.Drawing.WatermarkPosition.Behind;
pictureWatermark1.PrintOnFirstPage = true;
pictureWatermark1.PrintOnLastPage = true;
pictureWatermark1.Sizing = Telerik.Reporting.Drawing.WatermarkSizeMode.ScaleProportional;
pictureWatermark1.Opacity = 1;
report1.PageSettings.Watermarks.Add(pictureWatermark1);
Looks like the property you are trying to set has been changed overtime and some issue may be still affecting it.
try this:
report.Style.BackgroundImage.ImageData = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(emzaUrl));
For some more reference about this problem you can find some more details here.
Update
I do not know your context because you have not described it. Since your problem may be caused by using a property that is not in use anymore, the answer above is to indicate that the property has been replaced by a new one with reference to the Telerik post detailing the topic.
However, you can add background images to your report in the whole report, in the header section, in the detailed section and in the footer section. In this picture you can see that I have added the background images in all 4 cases above described.
To achieve the above I have simply used the property of each section adding the picture. The relevant code generated in the designer.cs of the report is the following:
// pageHeaderSection1
//
this.pageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Cm(2.5D);
this.pageHeaderSection1.Name = "pageHeaderSection1";
this.pageHeaderSection1.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("pageHeaderSection1.Style.BackgroundImage.ImageData")));
this.pageHeaderSection1.Style.BackgroundImage.MimeType = "image/gif";
this.pageHeaderSection1.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
//
// detail
//
this.detail.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("detail.Style.BackgroundImage.ImageData")));
this.detail.Style.BackgroundImage.MimeType = "image/gif";
this.detail.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
//
// pageFooterSection1
//
this.pageFooterSection1.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("pageFooterSection1.Style.BackgroundImage.ImageData")));
this.pageFooterSection1.Style.BackgroundImage.MimeType = "image/gif";
this.pageFooterSection1.Style.BackgroundImage.Repeat = Telerik.Reporting.Drawing.BackgroundRepeat.NoRepeat;
//Report1
this.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("Report1.Style.BackgroundImage.ImageData")));
this.Style.BackgroundImage.MimeType = "image/gif";
Here you can find a video with the result. If you still have problems, please describe accurately your context (versions, code, type of report if it is in a class library or if it is a trdx, etc..). With the information you have supplied this is the best I could answer.
Alternatively you may try to set a watermark instead of the background picture.