Examples of PDFStructElem


Examples of org.apache.fop.pdf.PDFStructElem

    }

    private static class TableCellMapper implements Mapper {

        public PDFName getStructureType(PDFObject parent) {
            PDFStructElem grandParent = (PDFStructElem)
                ((PDFStructElem)parent).getParentStructElem();
            //TODO What to do with cells from table-footer? Currently they are mapped on TD.
            PDFName type;
            if (THEAD.equals(grandParent.getStructureType())) {
               type = (PDFName) STANDARD_STRUCTURE_TYPES.get("TH");
            } else {
                type = (PDFName) STANDARD_STRUCTURE_TYPES.get("TD");
            }
            assert type != null;
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

     * @param structureTree the structure tree of the current page sequence
     * @param language language set on the page sequence
     */
    void processStructureTree(NodeList structureTree, Locale language) {
        pdfDoc.enforceLanguageOnRoot();
        PDFStructElem structElemPart = pdfDoc.getFactory().makeStructureElement(
                FOToPDFRoleMap.mapFormattingObject("page-sequence", rootStructureElement),
                rootStructureElement);
        rootStructureElement.addKid(structElemPart);
        if (language != null) {
            structElemPart.setLanguage(language);
        }

        for (int i = 0, n = structureTree.getLength(); i < n; i++) {
            Node node = structureTree.item(i);
            assert node.getLocalName().equals("flow")
                    || node.getLocalName().equals("static-content");
            PDFStructElem structElemSect = pdfDoc.getFactory().makeStructureElement(
                    FOToPDFRoleMap.mapFormattingObject(node.getLocalName(), structElemPart),
                    structElemPart);
            structElemPart.addKid(structElemSect);
            NodeList childNodes = node.getChildNodes();
            for (int j = 0, m = childNodes.getLength(); j < m; j++) {
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

    private void processNode(Node node, PDFStructElem parent, boolean addKid) {
        Node attr = node.getAttributes().getNamedItemNS(InternalElementMapping.URI, "ptr");
        assert attr != null;
        String ptr = attr.getNodeValue();
        PDFStructElem structElem = pdfDoc.getFactory().makeStructureElement(
                FOToPDFRoleMap.mapFormattingObject(node, parent, eventBroadcaster), parent);
        // TODO necessary? If a page-sequence is empty (e.g., contains a single
        // empty fo:block), should the block still be added to the structure
        // tree? This is not being done for descendant empty elements...
        if (addKid) {
            parent.addKid(structElem);
        }
        String nodeName = node.getLocalName();
        if (nodeName.equals("external-graphic") || nodeName.equals("instream-foreign-object")) {
            Node altTextNode = node.getAttributes().getNamedItemNS(
                    ExtensionElementMapping.URI, "alt-text");
            if (altTextNode != null) {
                structElem.put("Alt", altTextNode.getNodeValue());
            } else {
                structElem.put("Alt", "No alternate text specified");
            }
        }
        structTreeMap.put(ptr, structElem);
        NodeList nodes = node.getChildNodes();
        for (int i = 0, n = nodes.getLength(); i < n; i++) {
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

        pdfDoc.registerObject(pageParentTreeArray);
        parentTree.getNums().put(currentPage.getStructParents(), pageParentTreeArray);
    }

    private MarkedContentInfo addToParentTree(String structurePointer) {
        PDFStructElem parent = (PDFStructElem) structTreeMap.get(structurePointer);
        if (parent == null) {
            return ARTIFACT;
        } else {
            pageParentTreeArray.add(parent);
            String type = parent.getStructureType().toString();
            int mcid = pageParentTreeArray.length() - 1;
            return new MarkedContentInfo(type, mcid, parent);
        }
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

        parentTree.getNums().put(structParent, link);
        PDFDictionary contentItem = new PDFDictionary();
        contentItem.put("Type", OBJR);
        contentItem.put("Pg", this.currentPage);
        contentItem.put("Obj", link);
        PDFStructElem parent = (PDFStructElem) structTreeMap.get(structurePointer);
        parent.addKid(contentItem);
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

        pdfDoc.registerObject(pageParentTreeArray);
        parentTree.getNums().put(currentPage.getStructParents(), pageParentTreeArray);
    }

    private MarkedContentInfo addToParentTree(PDFStructElem structureTreeElement) {
        PDFStructElem parent = (structureTreeElement instanceof PDFStructElem.Placeholder)
                ? structureTreeElement.getParentStructElem()
                : structureTreeElement;
        pageParentTreeArray.add(parent);
        String type = parent.getStructureType().toString();
        int mcid = pageParentTreeArray.length() - 1;
        return new MarkedContentInfo(type, mcid, structureTreeElement);
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

        this.eventBroadcaster = eventBroadcaster;
    }

    public void startPageSequence(Locale language, String role) {
        ancestors = new LinkedList<PDFStructElem>();
        PDFStructElem structElem = createStructureElement("page-sequence", rootStructureElement, role);
        if (language != null) {
            structElem.setLanguage(language);
        }
        rootStructureElement.addKid(structElem);
        ancestors.add(structElem);
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

    public void endPageSequence() {
    }

    public StructureTreeElement startNode(String name, Attributes attributes) {
        PDFStructElem parent = ancestors.getFirst();
        String role = attributes.getValue("role");
        PDFStructElem structElem = createStructureElement(name, parent, role);
        parent.addKid(structElem);
        ancestors.addFirst(structElem);
        return structElem;
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

    private void removeFirstAncestor() {
        ancestors.removeFirst();
    }

    public StructureTreeElement startImageNode(String name, Attributes attributes) {
        PDFStructElem parent = ancestors.getFirst();
        String role = attributes.getValue("role");
        PDFStructElem structElem = createStructureElement(name, parent, role);
        parent.addKid(structElem);
        String altTextNode = attributes.getValue(ExtensionElementMapping.URI, "alt-text");
        if (altTextNode != null) {
            structElem.put("Alt", altTextNode);
        } else {
            structElem.put("Alt", "No alternate text specified");
        }
        ancestors.addFirst(structElem);
        return structElem;
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFStructElem

        ancestors.addFirst(structElem);
        return structElem;
    }

    public StructureTreeElement startReferencedNode(String name, Attributes attributes) {
        PDFStructElem parent = ancestors.getFirst();
        String role = attributes.getValue("role");
        PDFStructElem structElem;
        if ("#PCDATA".equals(name)) {
            structElem = new PDFStructElem.Placeholder(parent, name);
        } else {
            structElem = createStructureElement(name, parent, role);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.