views:

988

answers:

2

We have developed a set of crystal reports (not my idea) that are to recreate some sample PDF forms that we have been sent. We've imported background images (taken from the original PDF) for each page in the report and then we have dragged our data fields on top of these.

Now, despite the original images that we are using for backgrounds being relatively small, the rpt file is extremely large (approx. 50 MB). This is a bit of a nuisance, but now when we deploy to the server, we're finding that we're getting intermittent out of memory errors when trying to run the report.

Has anybody any ideas about:

  1. A better way to do this.

  2. A reason why this report file is so large (and how to reduce it).

  3. An idea why we're getting the out of memory errors.

A: 

Most likely, those errors are from the images themselves. While you might pass them as small JPG files to the report, it could be that the report itself translates them to bitmaps, which can be real huge.

Step one: recreate the report without any images to make sure if the images cause the huge size. If size goes down to e.g. 5 MB, you know for sure that the images will cause the problem and need to find a way around these.

To solve this, you would need to find a way to tell the report to store those images with JPG compression to reduce the size again. I don't know if this is possible with Crystal Reports and/or your project, though.

(In the worst case, your report is not only storing those images as bitmaps, but it would also stretch them to a size that covers the whole page, thus making them even much bigger!)

Workshop Alex
I've already run through the process of verifying that the images cause the problems. I can see no way within crystal reports to tell it how to store the image, which is a bit of a nuisance...
Paddy
So, you need to reduce the size of those images somehow. Or add more memory to the server. Are you using a 32-bits server or 64-bits server? If 64-bits, is the web application designed as 64-bits too, including Crystal Reports?
Workshop Alex
A: 

Wow, nasty. Are you able to split these reports up so there's only one image per report?

If not, then you'll have to look at loading the images into the report via code. Saving images within the reports themselves always seems to bloat a Crystal Report massively (like it stores them internally as TIFFs or something), but there are probably ways to do this via code using smaller images. This code sample might help :

https://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/f02cd85d-cf66-2b10-878d-9337242838f0

CodeByMoonlight
This is the approach that we're looking at taking. Makes designing the report a bit more of a nuisance, but it looks like it's necessary. Thanks for the link - one of the few out there that actually points at the SAP site, rather than the old, dead business objects site.
Paddy