Spire.PDF 9.7.14 已发布。本次更新新增支持在将 PDF 转换为 Word 时保留相同的字体名字以及在加密 PDF 文档时使用新接口设置加密选项。本次更新还增强了 PDF 到图片的转换功能。此外,一些已知问题也在本次更新中被修复,如文件添加水印时获得的 PDF 页数不正确的问题。详情请阅读以下内容。
新功能:
- 支持在将PDF转换为Word时保留相同的字体名字。
- 支持在加密PDF文档时使用新接口设置加密选项。
PdfDocument doc = new PdfDocument();
//Add a new page
PdfPageBase page = doc.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(1);
PdfGridRow headerRow1 = grid.Headers.Add(1)[0];
//HEADER WITHOUT UNCICODE SUPPORT BUT VALID WORD FONT
headerRow1.Style.Font = new PdfTrueTypeFont(new Font("Arial", 11f, FontStyle.Regular), true);
headerRow1.Cells[0].Value = "Spire.PDF for .NET";
headerRow1.Cells[0].StringFormat = new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);
grid.Draw(page, new PointF(0, 10));
//Save the document to stream
MemoryStream stream = new MemoryStream();
doc.SaveToStream(stream, FileFormat.PDF);
stream.Position = 0L;
PdfToWordConverter converter = new PdfToWordConverter(stream);
converter.SaveToDocx(@"out.docx");
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"in.pdf");
PdfSecurityPolicy securityPolicy = new PdfPasswordSecurityPolicy(userPassword, ownerPassword);
securityPolicy.EncryptMetadata = false;
securityPolicy.EncryptionAlgorithm = PdfEncryptionAlgorithm.AES_128;
securityPolicy.DocumentPrivilege = PdfDocumentPrivilege.AllowAll;
securityPolicy.DocumentPrivilege.AllowPrint = false;
doc.Encrypt(securityPolicy);
doc.SaveToFile(@"out.pdf");
问题修复:
- 修复了将PDF转换为图像时内容丢失的问题。
- 修复了打印PDF文件后,表格边框粗的问题。
- 修复了打开转换后的PDFA3B文件时出现提示“cannot extract the embedded font”的问题。
- 修复了文件添加水印时获得的PDF页数不正确的问题。
- 优化将PDF转换为图像时的内存消耗。
- 修复了应用程序在加载PDF文件时抛“System.NullReferenceException”的问题。
- 修复了应用程序在加载XPS文件时抛“System.IndexOutOfRangeException”的问题。
- 修复了将PDF转换为图像后结果是黑色的问题。
- 修复了应用程序在将PDF文件转换为图像时引发“System.NullReferenceException”的问题。
- 修复了移除Form域方法未生效的问题。
获取 Spire.PDF 9.7.14请点击: