Spire.PDF 11.12.0 现已正式发布。该版本新增 PdfFreeTextAnnotation.StringFormat 属性,用于设置文本的水平与垂直对齐方式,并对 WPF 平台下的 PDF 转图片渲染逻辑进行了优化。同时,还修复了多项与 PDF 转换、多语言文本渲染以及注释处理相关的问题。更多详情如下。
调整:
- 改进了 WPF 平台下 PDF 渲染为图像的底层逻辑,输出图像效果明显改善。
新功能:
- 废弃了 PdfFreeTextAnnotation.TextAlignment 属性,新增 PdfFreeTextAnnotation.StringFormat 支持设置水平与垂直对齐方式。
- 修复了表单域输入阿拉伯语字符时,字符方向显示不正确的问题。
- 修复了转换 XPS 到 PDF,内容不一致的问题。
- 修复了转换 PDF 到 PDF/A-3a,阿拉伯语及希伯来语显示不正确的问题。
- 修复了转换 PDF 到 PPTX 时,文本块被拆分成多行的问题。
- 修复了取消注释边框不生效的问题。
- 修复了转换 OFD 到 PDF 时程序抛出异常的问题。
- 修复了转换 PDF 到图片时线条注释丢失的问题。
PdfDocument newPdf = new PdfDocument();
PdfPageBase page = newPdf.Pages.Add();
Spire.Pdf.Graphics.PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 10f);
SizeF textSize = font.MeasureString("sample");
RectangleF rect = new RectangleF(50,50, textSize.Width, textSize.Height);
Spire.Pdf.Annotations.PdfFreeTextAnnotation textAnnotation = new Spire.Pdf.Annotations.PdfFreeTextAnnotation(rect);
textAnnotation.Text = "sample";
textAnnotation.Subject = "subject";
textAnnotation.Font = font;
Spire.Pdf.Annotations.PdfAnnotationBorder border = new Spire.Pdf.Annotations.PdfAnnotationBorder(8);
textAnnotation.Border = border;
textAnnotation.LineEndingStyle = Spire.Pdf.Annotations.PdfLineEndingStyle.None;
textAnnotation.Size = new SizeF(textSize.Width * 1.5F, textSize.Height * 1.5F);
textAnnotation.StringFormat.Alignment = PdfTextAlignment.Center;
textAnnotation.StringFormat.LineAlignment = PdfVerticalAlignment.Middle;
page.Annotations.Add(textAnnotation);
newPdf.SaveToFile(result);
问题修复:
获取 Spire.PDF 11.12.0,请点击:







