Spire.PDF 9.10.2 已发布。本次更新新增支持按阅读顺序获取分栏文档的文本坐标、为 PdfStringFormat 设置 HorizontalScalingFactor 属性以及在转换有权限密码的PDF时设置是否允许转换。同时该版本还增强了 OFD 到 PDF 的转换。此外,一些已知问题也在该版本种得到修复,如提取的表格数据格式不正确的问题。详情请阅读以下内容。
新功能:
- 支持按阅读顺序获取分栏文档的文本坐标。
- 支持为 PdfStringFormat 设置 HorizontalScalingFactor 属性。
- 支持在转换有权限密码的PDF时设置是否允许转换。
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(input);
PdfPageBase pdfPageBase = doc.Pages[0];
PdfTextFinder finder = new PdfTextFinder(pdfPageBase);
finder.Options.Strategy = PdfTextStrategy.Simple;
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
string text = "Please add the code picture BehindText=true to set the picture behind text";
PdfSolidBrush solidBrush = new PdfSolidBrush (new PdfRGBColor(Color.Black));
PdfStringFormat format = new PdfStringFormat():
format.HorizontalScalingFactor = 80;
PdfFont font = new PdfFont(PdfFontFamily.TimesRoman, 14f, PdfFontStyle.Regular);
PdfGraphicsState state = page.Canvas.Save();
page.Canvas.DrawString(text, font, solidBrush, 0, 0, format);
page.Canvas.Restore(state):
doc.SaveToFile(outputFile);
doc.Close();
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(inputFile);
doc.ConvertOptions.ApplyPermissionsOptions(true);
StringBuilder sb = new StringBuilder();
foreach (FileFormat type in Enum.GetValues(typeof(FileFormat)))
{
try
{
if (type.ToString().Equals("PDF"))
{
doc.SaveToFile(outputFile_P, type);
}
else
{
doc.SaveToFile(outputFile, type);
}
}
catch (Exception ex)
{
sb.AppendLine("save to: "+ type +" :"+ ex.Message);
}
}
File.AppendAllText(outputFile,sb.ToString());
doc.Dispose();
问题修复:
- 修复了提取的表格数据格式不正确的问题。
- 修复了给表格设置单元格间距后,输出结果不正确的问题。
- 修复了XFA的文本框表单域填充不成功的问题。
- 修复了程序在合并PDF文件时抛出“System.IO.IOExceptions:Stream was too long”异常的问题。
- 修复了填充textbox域后字体应用不正确的问题。
- 修复了有权限密码的PDF转换到Word时没有请求输入权限密码的问题。
- 修复了程序在转OFD到PDF文件时抛出“System.NullReferenceException”异常的问题。
- 修复了“new PdfGoToAction(partBookmarkDest)”不生效的问题。
获取 Spire.PDF 9.10.2请点击: