Unable to Bind Byte[] to Image in ActiveReports12

Posted by: megan.baluch on 2 March 2021, 7:19 am EST

  • Posted 2 March 2021, 7:19 am EST

    Hello!

    I am struggling to bind a byte[] of an image to the Image control in an RDL Report. The below is what is in the .rdlx:

    <Image Name="imgSignature">													
    <Height>0.625in</Height>
    <Left>1.833333in</Left>
    <MIMEType>image/jpeg</MIMEType>
    <Sizing>Fit</Sizing>
    <Source>External</Source>
    <Style />
    <Value>=Fields!SignatureField.Value</Value>
    <Width>3.7917in</Width>
    <ZIndex>1</ZIndex>
    </Image>


    The rest of the text fields bind fine and I have the appropriate dataset created.

    My C# code is where this gets fuzzy. I use an OnLocateDataSource event to bind the data with the values I want populated in the report. However, i'm unsure what my SignatureField field type should be. Should I be converting my byte[] to a base64 string? An Image? I swear I've tried every possible combination of things and never see the image populated.

    This is a user input image so it will not be embedded nor can I point to a specific location for it.
  • Replied 2 March 2021, 3:10 pm EST

    Hello,

    Please change the Source of image from External to 'Database'.
    <Source>External</Source>
    Thanks,
    Mohit
  • Replied 3 March 2021, 1:46 am EST

    Hi Mohit, I've tried that too with no success. My biggest confusion of what I should be passing into SignatureField. Should it be a base64 string?
  • Marked as Answer

    Replied 4 March 2021, 2:01 am EST

    Hello,

    Byte[] array should work. I have tested with the AdventureWorks database and it work successfully at my end. Please check the attached report.
    If you are still able to reproduce the issue, please share the report with dummy db so that I can look into the issue and help you further.

    Thanks,
    Mohit
    rpt_Img.zip
  • Replied 4 March 2021, 3:40 am EST

    Yes! Got it! Thank you so much Mohit!
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels