RDLC + ReportViewer Control - how to display images from the database? - image

I am storing GIF images (I can switch to BMP if necessary) in a varbinary column in SQL 2008. I want to display these images in a PDF rendered by the ReportViewer control from my RDLC.
How do I have to reference the image data in the report to make that work?
=First(Fields!sh_lot_num_barcode_image.Value, "DataSet1"))
A simple field reference does not seem to do the trick.

So it turns out my question was already asked before and self-answered. Give Tina your vote!
Together with Kevin's answer it got me on the right trail. I ended up adding a property to my Linq stored procedure results class that invokes the image HTML Handler. I changed the MIME type to BMP and it works like a charm - I can drop the database column now and don't need to jump through hoops to compose the URL for the image service. This property below I can directly assign to the image control.
public byte[] NDCLabel {
get {
return
BarcodeUtilities.ConvertImageToByteArray(
BarcodeUtilities.GetBarcodeImage(this.ndc)
,System.Drawing.Imaging.ImageFormat.Bmp);
}
}

Have you considered writing an HTTP Handler to read the image from the database and write it to the response stream? Then you can set the image control in your report to use the URL as the source and it should render in the output.
I don't have any actual images as blobs in a database to test with, but I did something sorta similar when I needed to render rich text on a report.

Related

How to overlap Label and Data fields over an image in BIRT

Using BIRT. Added Image in a Grid. Unable to put label and data fields over image in certain region. Please advise if you achieved it.
Thanks,
Yasar
I think all you can do is use the image as background-url. AFAIK this only works for images that actually come from an URL, but not for images that come from e.g. a database BLOB (but you might download the BLOB to a temporary file and use the file name as URL).

Oracle Unifier image data to be displayed in BI Report, image data is showing just a number

Oracle Unifier image data to be displayed in BI Publisher Report, image data in the field is showing just a number. like 446 and there is another field which show a jpg file name only like 2121.jpg. And when I looked at many post around found that there is some data inside.
like below. You might have noticed on right side the example is blob i.e. some string data is there. In the unfier i just got a field value 446. So my question is how do I go about displaying the image.
I refered to this document but could not get anywhere
https://docs.oracle.com/cd/E91461_01/English/Install_and_Upgrade/Configuring/bi_publish/unifier_bi_publisher_config.pdf
and I also tried Another way to work on getting the image
but again i have the same problem my field is in numnber the people trying it out have field value in blob
https://community.oracle.com/thread/4095157
enter link description here
Below is what I worked on and got to this point.
Image in BI Publisher report from the data is not displaying. I have followed the instructions and created the url and saved it in the ALT text of the image in RTF it is not displaying the image. Below are the instructions that I have followed.
Page 16 --> Configuring BI Publisher Reports to Use Unifier Images from the below document
https://docs.oracle.com/cd/E91461_01/English/Install_and_Upgrade/Configuring/bi_publish/unifier_bi_publisher_config.pdf
The ALT Text in the image is --> url:{concat($uuu_p_urlF,'/',COMLOGO,'/',//security_token/SEC_TOKEN1)}
It id generating the correct url -->http://IPADD/bluedoor/rest/image/453/A30DEAC4-4C63-12C7-3071-7A19048E848F
If i use this url i can see the image in the browser but the same link in the ALT Text field of the image does not display the image.
Would like to to what I am doign wrong

Rotativa Issue printing RAW HTML

(More specific Giorgio Bozio)
I have been using Rotativa for the last year to print simple html to pdf and its been working fantastic. Very happy with product, but now recently i have been trying to do something a little more advance and i keep having the same issue.
Normally i would send Rotativa a simple invoice view (Predefined HTML) with model data populated via Razor and this worked well, but now i am trying to implement template's for my invoices. Customers can create their own template layouts with a custom 3rd party form designer and then upload its template file into my site. I take this file and parse it and generate the elements of the invoice with stringbuilder and div tags. I then send the generated HTML to the view that uses a #HTML.Raw() to populate the invoice html. Rotativa then takes this View and generates a pdf, but when it generates the pdf its quality of the text is horrible and blurry. Thus it generates the template correctly, but does some sort of shrinking or something to make the text not look crisp.
I have tried everything, from playing with custom switches to playing with the dimensions of the html.
When i copy the generated html to a view and just generate the pdf plainly then it prints fine, but as soon as i push the html to the view with HTML.Raw i seem to land up with fussy text.
Giorgio Bozio, does Rotativa have a issue with Html.Raw? or can you perhaps open a dialog with me to try and resolve this issue? Really hope you can help me...or someone can help me. Desperate and dont really want to change Rotativa for something else.
Please help.
Resolved Text printing issue by removing background-color definitions on Div containers.
Resolved extra blank page printing issue by reducing PageHeight on Rotativa Customswitches
:-)

In Reporting services, how do I add an image from a string or cell in the table?

What I'm trying to do is this: I have a string with the full path to the image. I tried to add an external image to my report and set the image source to my string. but every time I load the report, it doesn't load the image. How do I do this, or is there a better way of doing this?
Thank you
For an External image, the image source needs to be a URL for the image. Reporting Services will try to get the image using anonymous access.
http://technet.microsoft.com/en-us/library/dd220527.aspx
Ok, I got it figured out. What I did was in the image properties, in the General Tab, I selected the image source as External, I then created a report parameter Called "#ImageURL", and selected it in the "Use this image:".
On the form I added this line of code:
ReportViewer1.LocalReport.SetParameters(New Parameter("ImageURL", string.concat("file:\","C:\ImagesFolder\ImageName.jpg")))
this brings up the image correctly.

any tutorials/blogs regarding uploading more than one db images

I have exhausting goggle looking for a way to upload more than one db images.
I had a look at
http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files or http://mattias-jakobsson.net/post/2009/11/19/Handling-image-uploads-with-AspNet-Mvc.aspx or http://www.johnpscott.co.uk/devnotes/picpick/default.aspx or http://rusanu.com/2010/12/28/download-and-upload-images-from-sql-server-with-asp-net-mvc/ and so on. I no luck.
Does anyone has a tutorial or recommend a book that demostrate how to upload more than one db images. I am using vs 2010, asp.net mvc3 in C# with SQL Server 2008R2. All I am trying to do is to have couple db images for each product.
Thanks
The first link you provided is a good start for what you need.
Store all images for a product change....
It shows how to upload multiple files. From this you could modify the table where the images are inserted to add a key for the record relation back to your product.
Retrieve all images for a product change...
To pull them back from the database you would call the code in the same article (GetFile), modifying the select statement to include your product key INSTEAD of the ID of the individual image.
Display all images for a product change...
This is where it changes quite a bit. The author of the first article still returns one file as a FileContentResult. Obviously, this won't work for your situation.
Have a look at this article. It uses an XML file to load up multiple images BUT you would replace this code with the code in GetFiles to create the Image List. It shows how to create a controller, model and view for this. You could create a partial view to have the images on the same page as the product view.
This sample shows how to get an image list out of the DB into a view. (To help with modifying GetFiles to better work for this...)

Resources