我已经尝试搜索这个并且代码应该尽可能地工作,但是我的Crystal Report中的结果图像是5页而不是1由于某种原因!
基本上,我有一个Crystal报表,其中从BlobField获取的整页图像在源图像宽2409像素,高300像素高3436像素时效果很好.
当我尝试使用1700宽,2436高@ 200 dpi的源图像时,图像高度太大,并将报告挂在下一页上
我认为"没问题,我只会调整图像大小并且报告会正确显示"但是我这样做有很大的困难.这是我正在使用的代码 - 当使用"正常"图像大小时而且这段代码,一切都在报告中显示得很好,但是如果我需要调整大小,它会在很大的范围内延伸到五页,这比单独留下更糟糕!:(
Dim fs As System.IO.FileStream = New System.IO.FileStream(FilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim Image() As Byte = New Byte(fs.Length - 1) {}
fs.Read(Image, 0, CType(fs.Length, Integer))
fs.Close()
'Byte[] to image
Dim imgMemoryStream = New IO.MemoryStream(Image)
Dim myImage = Drawing.Image.FromStream(imgMemoryStream)
' Check if image is 2409 wide, if it's not then resize to 2409 while preserving aspect ratio. WIN.
If myImage.Width <> 2409 Then
MsgBox("myimage before: " & myImage.Width & " by " & myImage.Height) …Run Code Online (Sandbox Code Playgroud)