【发布时间】:2019-12-02 15:35:57
【问题描述】:
我上传了一个 PDF 文件并将其转换为字节格式并保存在数据库中。在获取 PDF 字节数组时,我需要将它们转换为图像格式,以便我可以将图像插入到新的 PDF 报告中
SqlCommand objCmd = new SqlCommand(sTSQL, con);
objCmd.CommandType = CommandType.Text;
object result = objCmd.ExecuteScalar();
byte[] byteArray;
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, result);
byteArray = ms.ToArray(); // Byte Array
ms.Close();
ms = new MemoryStream(byteArray, 0, byteArray.Length);
ms.Seek(0, SeekOrigin.Begin);
System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);`enter code here`
错误声明:“参数无效”
【问题讨论】:
-
您需要一个 PDF 渲染器。
标签: c# pdf itext image-conversion