Crystal reports not showing blob images from dataset

Posted on 2006-04-11
Last Modified: 2012-05-05
Hello all,

I have a dynamically generated dataset with a tiff image base64 encoded in it.  I put the blob image into a reportdocument and it doesn't show up when I run the report.  I know the image is good because I can covert from base 64 then export to disk and the image will be there fine on the disk.  The app is in ASP.NET 2.0, CR 11 Developer.

XSD file looks like:
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="Table1">
        <xs:element name="Image1" type="xs:base64Binary" minOccurs="0" />
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="Table1" />

The code that loads the report looks like:

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dsCustoms As DataSet = CType(Session("sesCustoms"), DataSet)
Dim crCustoms As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim Mstream As New MemoryStream
Mstream = CType(crCustoms.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), MemoryStream)
Response.Buffer = True
Response.ContentType = "application/pdf"
End Sub

The report is fairly plain.  I put the blob image in the detail area and make sure that "Can Grow" is checked.

So, what am i doing wrong?  What's going on?  How do I fix it?

Question by:jfoutz
    LVL 42

    Expert Comment

    This is just a guess, but possibly Crystal can't handle the image format?  I would try putting a .bmp image and see if that works.  At least that will isolate whether the problem is the image or something else.
    LVL 26

    Expert Comment

    by:Kurt Reinhardt
    I believe frodoman is right.  Crystal only displays .jpg and .bmp images (.gifs if you view the report in a DHTML browser, but there are limitations).

    LVL 1

    Author Comment

    Well, the docs say that a tiff is an acceptable format, but it's not like it would be the first they were flat out wrong...  So, I was hoping you were right and did the conversion:

    Dim x As MemoryStream = New MemoryStream(Convert.FromBase64String(dsResponse.Tables(0).Rows(0).Item(0).ToString()))
    Dim y As System.Drawing.Image = System.Drawing.Image.FromStream(x)
    Dim z As New MemoryStream
    y.Save(z, System.Drawing.Imaging.ImageFormat.Bmp)
    dsResponse.Tables(0).Rows(0).Item(0) = Convert.ToBase64String(z.ToArray)

    I know the conversion worked because I can output it to disk and the image is there intact.  i.e.
    My.Computer.FileSystem.WriteAllBytes("c:\tmp1\tmp1.bmp", z.ToArray(), False)

    But...  still no image in my report.
    LVL 1

    Author Comment


    Is there any other way to get images into a report without resorting to temp files?  As I understand, a dataset is the only way.
    LVL 100

    Expert Comment

    With CR11 you are supposed to be able to put the image file name in the field and Crystal will pull up the image.

    Are you running a local application or is this a server application.  The image must be in the correct directory which may be the server or the client depending on how the application is run.

    LVL 1

    Author Comment

    So I finally broke down and opened a case with Business Objects.

    The problem turned out to be encoding…  Specifically, I was forwarding a base 64 string of the binary to Crystal, while Crystal will only accept a non-encoded byte array of the binary.  Of course the schema still had to specify that the field was a “xs:base64Binary” even though the data couldn’t be forwarded with base 64 encoding.  The other methods of sending data to Crystal such as an XML file can send a base 64 string no problem.  

    I requested that Business Objects consider either allowing a dataset to send blob images as base 64 strings (since that’s how they generally exist in databases anyways) in future builds, or specify in the documentation that a dataset can only pass a blob image on as a non-encoded byte array.

    Thank you to everyone who looked at this problem.

    Accepted Solution

    Closed, 500 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now