Example usage for com.lowagie.text.pdf PdfStructureTreeRoot mapRole

List of usage examples for com.lowagie.text.pdf PdfStructureTreeRoot mapRole

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfStructureTreeRoot mapRole.

Prototype

public void mapRole(PdfName used, PdfName standard) 

Source Link

Document

Maps the user tags to the standard tags.

Usage

From source file:net.sf.jasperreports.engine.export.JRPdfExporterTagHelper.java

License:Open Source License

/**
 *
 *//*from  w w  w  .  j a va2  s  . c  om*/
protected void init(PdfContentByte pdfContentByte) {
    this.pdfContentByte = pdfContentByte;

    if (isTagged) {
        PdfStructureTreeRoot root = pdfWriter.getStructureTreeRoot();
        allTag = new PdfStructureElement(root, new PdfName("All"));
        root.mapRole(new PdfName("All"), new PdfName("Sect"));
        if (pdfWriter.getPDFXConformance() == PdfWriter.PDFA1A) {
            root.mapRole(new PdfName("Anchor"), PdfName.NONSTRUCT);
            root.mapRole(PdfName.TEXT, PdfName.SPAN);
            root.mapRole(PdfName.IMAGE, PdfName.FIGURE);
        } else {
            root.mapRole(new PdfName("Anchor"), PdfName.TEXT);
        }

        if (language != null) {
            allTag.put(PdfName.LANG, new PdfString(language));
        }
        tagStack = new Stack<PdfStructureElement>();
        tagStack.push(allTag);
    }
}