首页 > 解决方案 > 如何从字节数组动态放置图像位置水晶报表

问题描述

我的问题很简单,但我没有找到解决方案。我知道当我有路径时如何动态修改图片。但在我的项目中,我收集了人们的签名。我不想要文件(不够安全)然后我将它存储在数据库中(我使用 signature_pad 和我使用的服务器端

 Dim dataUri = MesDonnees.Img
 Dim encodedImage = dataUri.Split(",")(1)
 Bdd.field = Convert.FromBase64String(encodedImage)
 ...

但我没有解决如何将它放在我的文档的页脚...我读了一些作品,但总是来自细节部分,我只有字符串类型、数字、布尔值......不是字节或其他东西谢谢你的帮助

更新 我有个主意。尝试将此图像链接到 ashx 文件

 Dim IdAtt As Long = CLng(HelperParams.GetParamURL("IdAttach"))
        Dim Typ As Integer = CInt(HelperParams.GetParamURL("Typ"))

            Dim LesDatas As New MyEntities
            Dim Att As Attachement = GetMonAttachement(IdAtt, LesDatas)
            If Att IsNot Nothing Then
                context.Response.ContentType = "image/png"
                If Typ = 1 Then
                    context.Response.BinaryWrite(Att.SignCollaborateur)
                Else
                    If Att.SignClient Is Nothing Then
                        Dim Vid() As Byte = New Byte(0) {}
                        context.Response.BinaryWrite(Vid)
                    Else
                        context.Response.BinaryWrite(Att.SignClient)
                    End If
                End If
                context.Response.Flush()
                context.Response.End()
            End If

    Catch ex As Exception
    End Try

如果我输入 IE:http://localhost:63888/Signature.ashx?IdAttach=4&Typ=2 我有我的图片

但我尝试创建 SignClient 参数并为其分配位置(x-2)

           cryRpt.SetParameterValue("SignClient", "~/Signature.ashx?IdAttach=4&Typ=2")
        cryRpt.SetParameterValue("SignClient", HttpContext.Current.Server.MapPath("/Signature.ashx") & "?IdAttach=4&Typ=2")
        cryRpt.SetParameterValue("SignClient", "http://localhost:63888/Signature.ashx?IdAttach=4&Typ=2")

这3种方法都行不通。

我尝试直接将:http://localhost:63888/Signature.ashx?IdAttach=4&Typ=2放在图像选项卡的位置(x-2)中:同上,我在 ashx 上设置了一个断点,永远无法到达。然后我打开网络选项卡开发工具,我的 ashx 从不调用。

我在标题(徽标)中有一张图片,我用路径文件(e:/../logo.png)更改了图片位置,这很好。

有人有想法吗?

标签: imagecrystal-reportsfile-handling

解决方案


最后,经过尝试和尝试,我找到的唯一解决方案是 1/ 制作子报告(我的请求仅返回 1 行) 2/ 在子报告中删除除详细信息部分之外的所有部分 3/ 创建一个具有属性 Contenu 作为 byte() 的类 4/将子报表中的数据字段添加到这个新类并删除详细信息部分中的字段

对于签名板,只需输入 backgroundcolor : rgb(255,255,255) 但 penColor : (1,1,1) 否则(CR 或 acrobat)显示黑色图像。


推荐阅读