cancel
Showing results for 
Search instead for 
Did you mean: 

Working with images in reports

montrothsten
Explorer
0 Kudos

(re-posted from .NET forum as recommended)

We are using CR 2008 integrated with a C#.NET 3.5 SP1 application. All of the data for our reports is provided by setting the datasource on a table (ex: ReportDocument.Database.Tables[0].SetDataSource()).

We have some reports that include images. These images are typically large (25 MB - 100+ MB) and may fill up the majority of a page. This is causing us no end of pain. There are two specific questions that I have.

If a report is being run for multiple object instances where each instance has an image associated with it we retrieve and set all of the data at the same time. This puts a very low limit on the number of objects that can be selected at once to run the report on. Ideally we would like some way to have a call-back on a per-object basis where we can provide the data for that object. This presumes that Crystal would free the memory used for each object as it called for the next one. Is there anyway to do this?

The second question is about a more efficient way to handle the images. Currently we are using a BlobField and passing it a byte array of the image. This approach appears to cause Crystal to use lots of memory and is related to the size of the image in the report. Images above 50 MB never display in the report. Is there a different, more efficient, way to include images on reports?

Thanks in advance,

-Mont

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Mont,

The BEST way is to use an external application to re-size the images to a desired file size and or dimensions. I like [FastStone Photo Resizer|http://www.faststone.org/FSResizerDetail.htm] because it works in bulk, allows you to save out copies without affecting the originals, it's light weight and fast.

As for the 2nd question... Databases are designed to store, sort and retrieve data. Adding huge image files can hurt performance. I've always been told that it's better to store a link or file path in the database but store the actual images in a network share. A simple Google search will find plenty of links discussing the topic.

As for being able to have the user call the images individually after the the report has run... There's now way. CR doesn't have any user interactive controls that can be place on the report surface itself.

Just my 2 cents...

Jason

montrothsten
Explorer
0 Kudos

Thanks for replying.

Unfortunately resizing doesn't help much as the primary culprit seems to be the size of the display area in the report. Even images that are only 2-3 MB cause us to run out of memory if there are more than a couple included in the report.

As for databases and images, I should have been clearer. I meant we are using CR's BlobField, not that we are storing the image in a database. We store them on disk. The issue is that this BlobField seems to be very inefficient in how it handles images. I am looking for an alternative to the BlobField for displaying images in a report.

I donu2019t need the user to call the images from the interface, I am looking for a way for CR to load the data one object at a time. Here is what is currently happening:

1) A report exists that includes a image and a bunch of data related to the image.

2) The user selects 1-N images that they want to run the report for.

3) In CR this generates multiple interations of the report, one for each image, and they all appear in the viewer and/or are printed as one job. All of the data and images are handed to CR at the same time.

Here is what I would like to happen:

1) A report exists that includes an images and a bunch for data related to the image.

2) The user selects 1-N images that they want to run the report for.

3) As the report is printed, or as the user pages through the report, for each image/object/iteration of the report, a callback is made to our application for the data. CR can free the memory from the previous iteration before it loads the data for the next iteration.

Thanks,

-Mont

Former Member
0 Kudos

Sounds like a you'd be better off using a linked sub-report. Have a main report that acts like a table of contents with a hyperlink for each image. The user would use the hyperlink to execute the sub-report with more detailed info on an individual image.

I haven't used CR for VS so I don't know what the differences are between that and the standard developer but using a blob field typically indicates the image is stored in the database itself.

Jason

montrothsten
Explorer
0 Kudos

Thanks for the suggestion. The subreport/TOC/hyperlink idea is one I hadn't thought of. I'll have to ponder it.

If we don't feel that meets our needs I am starting to think we may just have to go back to hand coding reports that use images. Not what I want to do but at least we know we can control the memory issues then.

-Mont

Former Member
0 Kudos

This probably the wrong forum to suggest this, but if you aren't married to the idea of using Crystal Reports take a look at SQL Server Reporting Services (even if you aren't using SQL Server as a back end). It's got some really nice features and capabilities that CR is missing. Plus it's "drill through" feature would make short work of this particular report.

If you have VS2005 or higher you already have the report designer. You can even use the Express Edition with advanced services for the report server itself.

... Something to before you start hand coding reports from scratch...

Jason

montrothsten
Explorer
0 Kudos

Thanks for the suggestion. I don't want to be hand coding these.

-Mont

Answers (1)

Answers (1)

Former Member
0 Kudos

I don't know if this will work for your situation or not. In our database we have a character field that has the path to the image. I have a report and I place an empty bitmap on it. I then choose to format that bitmap. I use a formula for the graphic location and place the name of the database field there. I set the image to can grow and also suppress it if that database field with the path is blank.

montrothsten
Explorer
0 Kudos

Using this approach do you have any memory issues? How large are your image files? How many images have you printed in a single report?

Sorry for all of the questions.

Thanks,

-Mont