37 lines
982 B
C#
37 lines
982 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace JingGong.Abp.Print.GoDEX
|
|
{
|
|
/// <summary>
|
|
/// 按base64打印图片
|
|
/// </summary>
|
|
public class GoDEXPrintBase64Image : GoDEXPrintImage
|
|
{
|
|
/// <summary>
|
|
/// Base64数据
|
|
/// </summary>
|
|
public string ImageBase64 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 获取图片数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override byte[] GetImageData()
|
|
{
|
|
var base64Content = ImageBase64;
|
|
// 检查是否包含 Base64 前缀
|
|
if (base64Content.Contains("base64,"))
|
|
{
|
|
// 去除 "data:image/<format>;base64," 头部信息
|
|
base64Content = base64Content.Substring(base64Content.IndexOf(",") + 1);
|
|
}
|
|
|
|
return Convert.FromBase64String(base64Content);
|
|
}
|
|
}
|
|
}
|