cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal ASP.net viewer not displaying blob field

0 Kudos

Hi

I have an oracle database with images stored in it as a blob field. I have a crystal report viewer application written in asp.net that works perfectly except it will not display the images from the database.

I have written a very simple report with crystal reports 13 with 2 fields on it, one the blob and one another field from the same table to make sure the something is returned from the database. If i refresh the report in crystal reports the image is displayed as expected. If i use the same report file in the asp.net viewer then it just displays white space in place of the image. The other string field is displayed fine.

What I have tried:

I have verified that the crystalimagehandler is working ok as i can put boarders around fields on the report and the image handler correctly displays these.

I have tried different settings for the image handler in the httphandler and handler sections of the web.config file. This didnt help other than verifying that when i had the wrong settings the crystalimagehandler failed to display the doarder around my string field and the images showed as broken links on the web page.

I have tried saving the image file into the database as a gif, tiff, jpg and bmp but the result is the same for all formats.

I have read numerous blog posts from across the internet but even though I have found similar issues I cant find a solution.

Any help would be very much appreciated!

DellSC
Active Contributor
0 Kudos

Which version of the .NET SDK are you using? Which version of Visual Studio?

0 Kudos

I am using 13.0.30.3805 of the crystal .net SDK and Visual Studio 2019.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Phil,

Sorry I meant to reply sooner.

R&D has put the TIFF support back into the product and will be in there in CR 2020 14.3.2. After this and SP 31 in CR for VS the registry key won't be required.

For now add this registry key:

HKEY_CURRENT_USER\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\FormatOptions String "SupportTiff" = Yes

And for CR for VS this key:

HKEY_CURRENT_USER\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports\FormatOptions

Have a great day

Don

Answers (15)

Answers (15)

0 Kudos

Hi Don

I have just installed sp31 and tested it with the crystal web client and I can confirm it works!

Many thanks for your assistance on this.

Phil

0 Kudos

Hi Phil,

I sent your report to R&D last night and they confirmed it's an issue in both CR 2016 and 2020 so I escalated this to them for a fix:

Here’s the case and KBA:

357377/2021 / Crystal Reports 2016/2020 and Oracle BLOB fields no longer display the image

3058569 - Crystal Reports 2016/2020 and Oracle BLOB fields no longer display the image

They'll confirm the fix works in code also...

Thanks for finding this and reporting it.

Not sure when the issue will be fixed in Crystal Reports Designer and hoping the fix, if needed, should be in CR for VS SP 31.

SP 31 is schedule for end of Aug as long as there are no ship killers in QA.

Thanks again

Don

Hi Don

Thanks for your support on this.

Can you confirm if there is a release date scheduled for version 31?

Thanks

Phil

0 Kudos

Hi Phil,

Is the image saved as a TIFF? We recently stopped supporting TIF's due to security issues...

Could be the problem...

Don

0 Kudos

Hi Don

No, they are normally bmp but i have tried as jpeg and png as well, I understand that gif is also not supported.

Thanks

Phil

0 Kudos

This is the version number for 2013:

2013 Support Pack 12

14.1.12.2983

0 Kudos

Hi Phil,

Doesn't work for them in CR 2016 either.

Asking to see if 2013 works for them

What patch are you on in CR 2013?

0 Kudos

Hi Don

I have done a test of my own. I downloaded a trial version of CR2020. I can confirm that the picture is not displayed in there as per the runtimes. I reconnected the datasource, set the location and tried re-adding the picture field from the field explorer and still could not get it to display, there is just whitespace.

Not sure if this helps but it looks like it broke after CR2013.

Thanks

Phil

0 Kudos

Hi Don

I did some further testing over the weekend, I got VS2017 working and used SP25 (ie 13.0.3500.00) and this displayed the images. So I guess its been broken in the 13.0.4000.00 dlls?

Thanks

Phil

0 Kudos

Interesting, My CR 2020 still doesn't show the image.

I've asked one of the other guys to check in CR 2016 for me....

If they confirm it's an issue I'll send it off to R&D and see what they say...

Thanks again

Don

0 Kudos

Hi Don

Just for information I am using cr2013.

Thanks

Phil

0 Kudos

Hi Phil,

Still no image.

Open the report in CR Designer, view the report and confirm the image is there. now save it with data. Open it again in CRD and confirm the image is there, then send me that one...

Don

0 Kudos

Hi Don

See the attached.

I went through the process of zipping, renaming and then sent to another colleague with crystal reports. They renamed back to zip, extracted and opened the file and they can see the picture. I have also put a boarder around it to show where it should be.

Thanks

Phil

test-for-don.txt

0 Kudos

Hi Phil,

No image. If you open the report in CR Designer do you see it? If you do send me that report.

It could be something i smissing from the BLOB field info, something in the header part of the image.

One line of your original post got me thinking "If i refresh the report in crystal reports the image is displayed as expected."

Now export the report with the image in it.

I see what the possible issue is....

When you add an OLE Object CR will only load it on first refresh, same in the SDK.

The way you need to add a picture object so it can be refreshed with each page change etc. is to create a field in your DB. It's been a while since I tested this so try this... In that field is a link to the field with the image in it.

Now place the Formula in the report and size the object accordingly.

Now when you view the report the formatting engine will read the link to the image field and display it.

I'll get one of the Report Design Resources to comment if I made an errors..

Don

0 Kudos

Hi Dom

Here is an upload of the exported report. When i load it in crystal reports application the image is definitely there, it still doesnt work in the viewer.

doc00116-old-export.txt

Your idea sounds like a good idea. I follow what you are saying but what would the new field look like? If you can give me an example of the link I will give it a go.

Thanks

Phil

0 Kudos

Hi Phil,

Internally CR converts all images to BMP format.

Can you use sample data and send me the report? I'll try it in my app. Simple report with just a field and the image would be perfect.

Do both, Export to RPT format from CR Designer and then again from the app, zip the reports up and then rename the zip to txt and attach.

Crystal also has a Native Oracle driver, see if that works.

If you do a quick test and export to PDF do the images show up in the PDF file? Confirms if its a viewer issue...

Don

0 Kudos

Hi Don

Thanks for your help!

Files attached as zip

don.txt

don2.txt

I exported the report as a rpt file from the viewer application and then reopened in crystal and the image is displayed in the crystal reports application.

Exporting to PDF its still not shown.

Thanks

0 Kudos

Sorry i also meant to add that i have tried with the native oracle driver and the results were the same.

0 Kudos

Oops, Rename it to *.zip and then unzip it.

<?xml version="1.0"?><!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  --><configuration>
  <appSettings>
      <add key="CrystalImageCleaner-AutoStart" value="true" />
      <add key="CrystalImageCleaner-Sleep" value="60000" />
      <add key="CrystalImageCleaner-Age" value="120000" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.7.2">
      <assemblies>
        <add assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
        <add assembly="CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
        <add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
        <add assembly="CrystalDecisions.ReportSource, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
        <add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
        <add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
      <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies>
    </compilation>
    <httpRuntime targetFramework="4.7.2"/>
  <httpHandlers><add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></httpHandlers></system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
    </compilers>
  </system.codedom>
<system.webServer><handlers><add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/></handlers><validation validateIntegratedModeConfiguration="false"/></system.webServer></configuration>
0 Kudos

Hi Don

So that works!

I have also opened the file in my origonal application and it works.

So that brings me back to why wont the viewer display pictures from my oracle database but the crystal reports application will.

Can you confirm the file type the pictures are saved as in the example?

Thank you for all the support!

0 Kudos

pictures-from-data-source.txt

I did a quick test using the old Xtreme.MDB file imported into MS SQL 2016 and it works for me.

Download and rename attached file to *.rpt and see if it works for you?

Then using the simplest web app to view the report:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Page_Init(object sender, EventArgs e)
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new ReportDocument();
            rpt.Load(@"d:\Reports\Pictures From Data Source.rpt", OpenReportMethod.OpenReportByTempCopy);
            CrystalReportViewer1.ReportSource = rpt;
        }
    }
}
0 Kudos

Hi Don

Thanks for that, I tried to download and rename the file to .rpt but it is corrupt for some reason. I unblocked it and also tried loading it in crystal reports but that didnt like it either.

I tried a new building a new application from scratch using your code above and the report I have been testing with but it didnt work, blank picture again. I did also have to rebuild the web.config file so I guess that could be the issue. Can you provide an example so that i can make sure that this isnt the issue?

0 Kudos

Interesting...

Surround the object with a coloured line and see if the object is there, maybe its being reduced in size???

I'll check with one of the DB guys to see if we have a sample BLOB image I can test with when I get time...

0 Kudos

Hi Don

I added the boarder around the image and the boarder is displayed in the asp.net page at the expected size with white space inside the boarder rather than the image from the database.

Thanks for your continued help!

0 Kudos

Use a report with saved data so you take the connection out of the picture.

Use Fiddler or ProcessMonitor to trace what the app is doing when rendering the report, should show you whats missing or if it's a permission issue accessing resources

0 Kudos

Hi Don

I did as you suggested, saved the report with the data in it then previewed it in the asp.net page without refreshing it. Again everything on the report is displayed apart from the picture. Looking at fiddler and chrome debugging information there are no errors. It returns a blank png with the following properties:

Format: PNG 323 bytes 96w x 96h 0.04 bytes/px 96 dpi Color: RGB+Alpha 8bits/sample Gamma: 0.4546

The image is saved in the db as a jpg. (although i have tried other formats)

Any further pointers?

Really appreciate the help!

0 Kudos

Try googling for examples.

CR is hardware and software reliant, meaning if you want to export to PDF then Adobe Reader needs to be installed on the WEB Server/App Server.

0 Kudos

Hi Don

Thanks, I am not actually trying to PDF anything I am just using the Crystal report viewer in the asp.net page. It is within this view the pictures are not displaying.

I was hoping that as they are viewable when previewing the report in crystal reports they would also be viewable in the asp.net viewer.

I did try one other thing and that was to change the report from using ODBC to the Oracle Provider for OLE DB just in case it was something to do with how the blob was returned using the ODBC connection, it didnt work!

I will do some more research into your suggestion.

Thanks

Phil

0 Kudos

It sounds to me like IIS doesn't have a BLOB interpreter to know what to do with that type.

Take CR out of the picture and try to display that blob in a basic web page without the CR viewer.

0 Kudos

Hi Don

Thanks for your suggestion. I am fairly new to this, any pointers or sample code on how to do this?

Isnt this what the crytsalimagehandler is designed to do? How does it do it in crystal reports and not in the crystal viewer? I am trying to get my head round the differences between the applications.

Thanks for your help!