Browse our Products

Aspose.PDF for Java 19.8 Release Notes

Features and Improvements

KeySummaryCategory
PDFJAVA-38770Render all contents in a single pageNew Feature
PDFJAVA-38814PDF/UA: Implement Table support in Tagged PDFNew Feature
PDFJAVA-38771HTML to PDF: Rendering HTML with SVGEnhancement
PDFJAVA-38551PDF to DOCX results in java.lang.IndexOutOfBoundsExceptionBug
PDFJAVA-38325SVG to PDF - Text is not rendering with correct fontBug
PDFJAVA-38791File handling issuesBug
PDFJAVA-38527HTML to PDF - Failed to parse URL Exception thrownBug
PDFJAVA-38784The code is throwing the NullPointException on savingBug
PDFJAVA-38555HTML to PDF - Failed to parse URL exception occurs if image tag has no valueBug
PDFJAVA-36943Spacing issue in the page numberingBug
PDFJAVA-37360When an image is inserted to PDF, the page is blankBug

Public API Changes

PDF/UA: Implement Table support in Tagged PDF

Table support was added to Tagged PDF. Use createTableElement() method of ITaggedContent interface to create table. For creating Head, Body and Foot for table use createTHead(), createTBody() and createTFoot() methods of TableElement object. Abstract class TableRowCollectionElement is base for TableTHeadElementTableTBodyElement and TableTFootElement classes.Method TableRowCollectionElement.createTR() creates the row for corresponded object. Table row object belong to TableTRElement calss. Methods TableTRElement.createTH() and TableTRElement.createTD() creates the row’s cell for corresponded row. You can also verify PDF/UA compliance of the created document. Code snippet below show how to use this functionality.

 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 document

document.save(dataDir+"TaggedTable_"+version+".pdf");

boolean isPdfUaCompliance = document.validate(new ByteArrayOutputStream(), PdfFormat.PDF_UA_1);

System.out.println("PDF/UA compliance: "+ isPdfUaCompliance);