Example usage for org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf StandardStructureTypes DOCUMENT

List of usage examples for org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf StandardStructureTypes DOCUMENT

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf StandardStructureTypes DOCUMENT.

Prototype

String DOCUMENT

To view the source code for org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf StandardStructureTypes DOCUMENT.

Click Source Link

Document

Document

Usage

From source file:org.apache.fop.render.pdf.pdfbox.StructureTreeMerger.java

License:Apache License

private void createParents(COSObject cosElem, COSObject cosParentElem, PDFStructElem elem) throws IOException {
    int elemObjectID = (int) cosParentElem.getObjectNumber();
    COSDictionary parentElemDictionary = (COSDictionary) cosParentElem.getObject();
    PDFStructElem elemParent = structElemCache.get(elemObjectID);
    if (isStructureTreeRoot(parentElemDictionary)) {
        elem.setParent(currentSessionElem);
        currentSessionElem.addKid(elem);
        topElems.add(cosElem);//from w  ww.jav  a  2  s. c  o  m
    } else if (elemParent != null) {
        if (!checkIfStructureTypeIsPresent(parentElemDictionary, StandardStructureTypes.TR)) {
            elem.setParent(elemParent);
            int position = StructureTreeMergerUtil.findObjectPositionInKidsArray(cosElem);
            elemParent.addKidInSpecificOrder(position, elem);
        }
    } else if (!checkIfStructureTypeIsPresent(parentElemDictionary, StandardStructureTypes.DOCUMENT)) {
        elemParent = createAndRegisterStructElem(cosParentElem);
        copyElemEntries(cosParentElem, elemParent);
        elem.setParent(elemParent);
        fillKidsWithNull(elemParent, (COSDictionary) cosParentElem.getObject());
        if (((COSName) parentElemDictionary.getDictionaryObject(COSName.S)).getName()
                .equals(StandardStructureTypes.TR)) {
            COSBase rowKids = parentElemDictionary.getItem(COSName.K);
            createKids(rowKids, parentElemDictionary, elemParent, true);
        } else {
            int position = StructureTreeMergerUtil.findObjectPositionInKidsArray(cosElem);
            elemParent.addKidInSpecificOrder(position, elem);
        }
        COSObject parentObj = (COSObject) parentElemDictionary.getItem(COSName.P);
        createParents(cosParentElem, parentObj, elemParent);
    } else {
        elem.setParent(currentSessionElem);
        int position = StructureTreeMergerUtil.findObjectPositionInKidsArray(cosElem);
        currentSessionElem.addKidInSpecificOrder(position, elem);
        topElems.add(cosElem);
    }
}