Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Considering the scenario where I print a number of invoices coming from different stores to a PDF document.

I initialize an image wrapper object with say 8 images (these are store logos) and dynamically it gets assigned to the report RDLC. But the issue is I get same image in every invoice page.

I get the storeId in the dataset, is it possible to assign store images to these pages depending on the storeid of the invoice, in order to distinguish invoices according to stores?

I tried with the following code (RDLC Code behind, by attaching the assembly)

C#
Public Function StoreImage(Storeid as Integer) as Byte()
	Try
		Return eCom.Handlers.LogoWrapper.GetImage(StoreId);
	Catch ex As Exception
		Return ex.Message
	End Try
End Function


Kindly guide me in this regard.

Thanks.
Posted

1 solution

Hello,
please see if this solution works for you -
I am assuming that you are using a web site to print invoices.
a) place all the logo images into your site folder, so that you have URLs for images
b) add a report parameter for the image URL (for eg. say the parameter is ImagePath)
c) in RDLC for the image set Source=External and Value=Parameters!ImagePath.Value
d) in the code behind, use Reportviewer.LocalReport.SetParameters to set the "ImagePath" report parameter.

Hope this helps.
 
Share this answer
 
Comments
GPUToaster™ 24-Jan-12 5:38am    
This solution works perfectly allright. Thanks for suggesting it! :)

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