Spire.PDF 12.2.14 现已正式发布。该版本支持通过 PdfHatchStyle 接口创建 Hatch Brush 画刷,并支持在替换 PDF 页面文本时配置文本颜色。同时,优化了 netstandard DLLs 的压缩功能以提升文件压缩比,一些在转换 PDF 到图片、添加图片或绘制字体时出现的问题也得以成功修复。更多详情如下。
优化:
- 优化 netstandard DLLs 压缩功能,提升文件压缩比。
新功能:
- 提供 PdfHatchStyle 接口支持创建 Hatch Brush 画刷。
- 支持在替换 PDF 页面文本时配置文本颜色。
PdfDocument pdf = new PdfDocument();
foreach (PdfHatchStyle type in Enum.GetValues(typeof(PdfHatchStyle)))
{
PdfPageBase page = pdf.Pages.Add();
PdfCanvas canves = page.Canvas;
Color foreColor = Color.FromArgb(255, 255, 255, 0);
Color backColor = Color.FromArgb(255, 78, 167, 46);
page.Canvas.DrawString(type.ToString(), new PdfTrueTypeFont(new System.Drawing.Font("Arial", 16)), new PdfSolidBrush(Color.Black), new PointF(0, 0), true);
PdfHatchBrush brush = new PdfHatchBrush(type, foreColor, backColor);
canves.DrawRectangle(brush, 100, 100, 300, 200);
}
pdf.SaveToFile(output);
pdf.Dispose();
PdfTextReplacer textReplacer = new PdfTextReplacer(page);
textReplacer.Options = textReplaceOptions;
textReplacer.ReplaceAllText("document", "file", Color.Red);
问题修复:
- 修复了转换 PDF 到图片效果不正确的问题。
- 修复了转换 PDF 到图片时阴影偏移的问题。
- 修复了添加图片到 PDF 时执行速度慢且生成文件体积过大的问题。
- 修复了绘制“MS Gothic”字体到页面时程序抛出 NullReferenceException 异常的问题。
获取 Spire.PDF 12.2.14,请点击:







