Images

Stimulsoft Reports.NET discussion
Post Reply
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Images

Post by poweredbyporkers »

Morning,

I have a report with an image control on it.
I have two business objects separated to decouple the logo as the report data can potentially generate 1000s of pages.
I have a business object passed into the report that contains data and one of the fields is a unique key to tell me what logo I should show for this page, let's say a guid.

public class ReportData
{
public int Id { get; set; }
public string Username { get; set; }
public string Hash { get; set; }
}

I have a business object passed into the report that contains images with a unique key, let's say a guid.

public class ReportLogos
{
public string Hash { get; set; }
public Image Logo { get; set; }
}

How can I assign a logo to the image control based on the current record being processed? What I need is to assign the associated Logo based on the Hash key.

Thanks!
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Re: Images

Post by poweredbyporkers »

Ok, one issue down once I had my thinking head on, and realised I'd forgotten to add "System.Collections.Generic." before Dictionary. D'Oh!

Anyways, I'm attempting to get the logo out of my dictionary and there are no errors but there's also no image tried this in BeforePrint and GetImageData events.

Code: Select all

InvoiceLogo.Image = (LogoCollection as System.Collections.Generic.Dictionary<string, Image>)[InvoiceHeader.LogoHash]
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Re: Images

Post by poweredbyporkers »

Ok, so that wasn't working so I've had to try something else.

But

It appears to me that large reports with images are very inefficient. My invoice run has 1254 pages and each page has a logo, but there are only two different logos used across all pages. When saved to an encrypted file it is 29mb which is fine, but when opened in the viewer it's using 1.5GB of memory and that's not good.

What is the accepted way to have a large report with a logo?
What is the accepted way to handle repeating images?

Thanks!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Images

Post by HighAley »

Hello.

We have send us answer to you by email and created an article in our knowledgebase for our customers.

Thank you.
Post Reply