Search in sources :

Example 1 with PDParentTreeValue

use of com.tom_roush.pdfbox.pdmodel.documentinterchange.logicalstructure.PDParentTreeValue in project PdfBox-Android by TomRoush.

the class PDFMergerUtility method updatePageReferences.

/**
 * Update the Pg and Obj references to the new (merged) page.
 */
private void updatePageReferences(PDFCloneUtility cloner, Map<Integer, COSObjectable> numberTreeAsMap, Map<COSDictionary, COSDictionary> objMapping) throws IOException {
    for (COSObjectable obj : numberTreeAsMap.values()) {
        if (obj == null) {
            continue;
        }
        PDParentTreeValue val = (PDParentTreeValue) obj;
        COSBase base = val.getCOSObject();
        if (base instanceof COSArray) {
            updatePageReferences(cloner, (COSArray) base, objMapping);
        } else {
            updatePageReferences(cloner, (COSDictionary) base, objMapping);
        }
    }
}
Also used : COSObjectable(com.tom_roush.pdfbox.pdmodel.common.COSObjectable) COSArray(com.tom_roush.pdfbox.cos.COSArray) PDParentTreeValue(com.tom_roush.pdfbox.pdmodel.documentinterchange.logicalstructure.PDParentTreeValue) COSBase(com.tom_roush.pdfbox.cos.COSBase)

Aggregations

COSArray (com.tom_roush.pdfbox.cos.COSArray)1 COSBase (com.tom_roush.pdfbox.cos.COSBase)1 COSObjectable (com.tom_roush.pdfbox.pdmodel.common.COSObjectable)1 PDParentTreeValue (com.tom_roush.pdfbox.pdmodel.documentinterchange.logicalstructure.PDParentTreeValue)1