Aspose.PDF for Java更新至v19.8,新增在标记PDF中实现表格支持,支持在单个页面中渲染所有内容,修复HTML到PDF无法解析引发的URL异常等问题。
Aspose.PDF for Java是一种快速,轻量级的PDF处理控件,无需使用Adobe Acrobat即可生成,修改,转换,渲染,保护和打印PDF文档。同时支持使用PDF,XFA,TXT,HTML,PCL,XML,XPS和图像文件格式。
Aspose.PDF for Java提供PDF压缩选项,表格创建和操作,图形支持,图像功能,广泛的超链接功能,扩展的安全控制和自定义字体处理。此外,开发人员可以通过其API或XML模板直接创建PDF文档,并可以创建表单或管理PDF文档中嵌入的表单域。
Aspose.PDF for Java更新至v19.8,新增在标记PDF中实现表格支持,支持在单个页面中渲染所有内容,修复HTML到PDF无法解析引发的URL异常等问题。>>欢迎下载Aspose.PDF for Java最新试用版
新增与改善
key | 概述 | 类别 |
---|---|---|
PDFJAVA-38770 | 在单个页面中渲染所有内容 | 新功能 |
PDFJAVA-38814 | PDF / UA:在标记PDF中实现表格支持 | 新功能 |
PDFJAVA-38771 | HTML到PDF:使用SVG渲染HTML | 增强 |
PDFJAVA-38551 | PDF到DOCX导致java.lang.IndexOutOfBoundsException | Bug修复 |
PDFJAVA-38325 | SVG到PDF – 文本没有使用正确的字体进行渲染 | Bug修复 |
PDFJAVA-38791 | 文件处理问题 | Bug修复 |
PDFJAVA-38527 | HTML到PDF – 无法解析引发的URL异常 | Bug修复 |
PDFJAVA-38784 | 代码在保存时抛出NullPointException | Bug修复 |
PDFJAVA-38555 | HTML到PDF – 如果图像标记没有值,则无法解析URL异常 | Bug修复 |
PDFJAVA-36943 | 页面编 中的间距问题 | Bug修复 |
PDFJAVA-37360 | 将图像插入PDF时,页面为空白 | Bug修复 |
新增功能演示
PDF / UA:在标记PDF中实现表格支持
使用ITaggedContent接口的createTableElement()方法创建表。要为表创建Head,Body和Foot,请使用TableElement对象的createTHead(),createTBody()和createTFoot()方法。
抽象类TableRowCollectionElement是TableTHeadElement,TableTBodyElement和TableTFootElement类的基础。方法TableRowCollectionElement.createTR()为对应的对象创建行。
表行对象属于TableTRElement calss。 方法TableTRElement.createTH()和TableTRElement.createTD()为相应的行创建行的单元格。 您还可以验证所创建文档的PDF / UA合规性。 下面的代码段显示了如何使用此功能。
Document document = new Document();ITaggedContent taggedContent = document.getTaggedContent(); taggedContent.setTitle("Table example - THead, TBody, TFoot; Summary");taggedContent.setLanguage("en-US");StructureElement rootElement = taggedContent.getRootElement(); TableElement tableElement = taggedContent.createTableElement();rootElement.appendChild(tableElement);TableTHeadElement tableTHeadElement = tableElement.createTHead();TableTBodyElement tableTBodyElement = tableElement.createTBody();TableTFootElement tableTFootElement = tableElement.createTFoot();int rowCount = 7;int colCount = 3;int rowIndex;int colIndex;TableTRElement headTrElement = tableTHeadElement.createTR();headTrElement.setAlternativeText("Head Row");for (colIndex = 0; colIndex < colCount; colIndex++){ TableTHElement thElement = headTrElement.createTH(); thElement.setText("Head Cell [head row, "+colIndex+" ]");}for (rowIndex = 0; rowIndex < rowCount; rowIndex++){ TableTRElement trElement = tableTBodyElement.createTR(); trElement.setAlternativeText("Row "+rowIndex); for (colIndex = 0; colIndex < colCount; colIndex++) { TableTDElement tdElement = trElement.createTD(); tdElement.setText("Cell ["+rowIndex+", "+colIndex+"]"); }}TableTRElement footTrElement = tableTFootElement.createTR();footTrElement.setAlternativeText("Foot Row");for (colIndex = 0; colIndex < colCount; colIndex++){ TableTDElement tdElement = footTrElement.createTD(); tdElement.setText("Foot Cell [foot row, "+colIndex+"]");} StructureAttributes tableAttributes = tableElement.getAttributes().getAttributes(AttributeOwnerStandard.Table);StructureAttribute summaryAttribute = new StructureAttribute(AttributeKey.Summary);summaryAttribute.setStringValue("The summary text for table");tableAttributes.setAttribute(summaryAttribute);// Save documentdocument.save(dataDir+"TaggedTable_"+version+".pdf");boolean isPdfUaCompliance = document.validate(new ByteArrayOutputStream(), PdfFormat.PDF_UA_1);System.out.println("PDF/UA compliance: "+ isPdfUaCompliance);
*想要购买Aspose正版授权的朋友可以联系客服哦~
ASPOSE技术交流QQ群()已开通,各类资源及时分享,欢迎交流讨论!
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!