net.sf.jasperreports.engine.export

## Class JRPdfExporterTagHelper

- java.lang.Object
- - net.sf.jasperreports.engine.export.JRPdfExporterTagHelper

-     public class JRPdfExporterTagHelper
      extends java.lang.Object

  Provides support for tagged PDF documents.

  PDF files can contain hidden tags that describe the structure of the document. Some of the tags are used by the automated reader tool that reads PDF documents aloud to people with disabilities.

  ### Marking Headings

  JasperReports currently supports specifying type 1, 2 and 3 level headings. In order to mark a text field as a level 1 heading, the following custom element property should be used in JRXML:

  `<property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>`

  Value full means that a full `<H1>` tag will be embedded in the PDF wrapping the current text element. If two or more text fields make up a single level 1 heading, there are two ways to mark the heading:
  - In the first, the text elements making up the heading are placed inside a frame and the frame is marked with the following custom property:
    `<property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>`
  - In the second, the first element of the heading (respective to the Z-Order, or the order in which the elements appear in JRXML) is tagged with:
    `<property name="net.sf.jasperreports.export.pdf.tag.h1" value="start"/>`
    and the last element from the heading (respective to the same order) is marked with
    `<property name="net.sf.jasperreports.export.pdf.tag.h1" value="end"/>`

  Level 2 and level 3 headings are marked the same way, except that the properties are:

  `net.sf.jasperreports.export.pdf.tag.h2`

  and

  `net.sf.jasperreports.export.pdf.tag.h3`.

  ### Marking Tables

  Tables are comprised of column headers, row headers, and a data section. Each table section is made of cells. Marking table structures in PDF is similar to the way tables are described in HTML and uses the same techniques as those for marking headings.

  When marking a table, the user has to indicate in the report template where the table starts and where it ends.

  If the entire table is placed in a container, such as a frame element, marking the table requires only marking the parent frame with the following custom element property:

  `<property name="net.sf.jasperreports.export.pdf.tag.table" value="full"/>`

  However, most of the time, tables cannot be isolated in a frame unless they are subreports, because they generally span multiple report sections and bands. In such cases, marking a table requires marking in JRXML the first and last element making up the table structure.

  The first element of the table (probably the first element in the table header) should be marked with the following custom property:

  `<property name="net.sf.jasperreports.export.pdf.tag.table" value="start"/>`

  The last element of the table should be marked with:

  `<property name="net.sf.jasperreports.export.pdf.tag.table" value="end"/>`

  Tables are made of rows, and each row has to be precisely delimited within the table structure. This includes the column header rows at the top of the table. Similar to the headings and table marking, a table row can be identified in two ways:
  - If the entire content that makes up the row is isolated within a frame, the frame can be marked with the following custom property:
    `<property name="net.sf.jasperreports.export.pdf.tag.tr" value="full"/>`
  - If the content of the row is not grouped in a container frame, its first and last elements (respective to the Z-order or the order in which they appear in JRXML) have to be marked with the following custom properties:
    `<property name="net.sf.jasperreports.export.pdf.tag.tr" value="start"/>`
    for the first element and
    `<property name="net.sf.jasperreports.export.pdf.tag.tr" value="start"/>`
    for the last element.

  Each table row can contain header cells or data cells. Regardless of their type, and similar to headings, tables, and table rows, cells can be marked either by marking a single element representing the cell content (this single cell element can actually be a frame element), or by marking the first and last element from the cell content.

  Header cells made of a single element (this single element can actually be a frame) are marked with

  `<property name="net.sf.jasperreports.export.pdf.tag.th" value="full"/>`

  A header cell made of multiple elements is marked with

  `<property name="net.sf.jasperreports.export.pdf.tag.th" value="start"/>` on its first element and

  `<property name="net.sf.jasperreports.export.pdf.tag.th" value="end"/>` on its last element.

  Normal data cells made of a single element (that can be frame) are marked with

  `<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>`

  Normal data cells made of multiple elements are marked with

  `<property name="net.sf.jasperreports.export.pdf.tag.td" value="start"/>` on their first element and

  `<property name="net.sf.jasperreports.export.pdf.tag.td" value="end"/>` on their last element.

  Just as in HTML tables, cells can span multiple rows and/or columns. Column span and row span values for the current table cell can be specified using the following custom properties on the same element where the cell start was marked (the element with the full or start property marking the cell):

  `<property name="net.sf.jasperreports.export.pdf.tag.colspan" value="<number>"/>`

  `<property name="net.sf.jasperreports.export.pdf.tag.rowspan" value="<number>"/>`

  ### PDF Content Reading Order

  JasperReports uses the Z-order of the elements as present in the report template (JRXML) to control reading order in the resulting PDF files. This is usually the intended way for the documents to be read, so no specific modifications were required in order to achieve it.
  Version:
    $Id: JRPdfExporterTagHelper.java 7063 2014-04-29 09:37:53Z shertage $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.lowagie.text.pdf.PdfStructureElement` | `allTag`
    `protected int` | `crosstabFrameDepth`
    `protected int` | `crtCrosstabRowY`
    `protected JRPdfExporter` | `exporter`
    `protected boolean` | `isDataCellPrinted`
    `protected boolean` | `isTagEmpty`
    `protected boolean` | `isTagged`
    `protected java.lang.String` | `language`
    `protected com.lowagie.text.pdf.PdfContentByte` | `pdfContentByte`
    `protected com.lowagie.text.pdf.PdfWriter` | `pdfWriter`
    `static java.lang.String` | `PROPERTY_TAG_COLSPAN`
    `static java.lang.String` | `PROPERTY_TAG_H1`
    `static java.lang.String` | `PROPERTY_TAG_H2`
    `static java.lang.String` | `PROPERTY_TAG_H3`
    `static java.lang.String` | `PROPERTY_TAG_ROWSPAN`
    `static java.lang.String` | `PROPERTY_TAG_TABLE`
    `static java.lang.String` | `PROPERTY_TAG_TD`
    `static java.lang.String` | `PROPERTY_TAG_TH`
    `static java.lang.String` | `PROPERTY_TAG_TR`
    `static java.lang.String` | `TAG_END`
    `static java.lang.String` | `TAG_FULL`
    `static java.lang.String` | `TAG_START`
    `protected java.util.Stack<com.lowagie.text.pdf.PdfStructureElement>` | `tagStack`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JRPdfExporterTagHelper(JRPdfExporter exporter)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `createEndTags(JRPrintElement element)`
    `protected void` | `createSpanTags(JRPrintElement element, com.lowagie.text.pdf.PdfStructureElement parentTag)`
    `protected void` | `createStartTags(JRPrintElement element)`
    `protected void` | `createTableStartTag()`
    `protected void` | `createTdStartTag(JRPrintElement element)`
    `protected void` | `createThStartTag(JRPrintElement element)`
    `protected void` | `createTrStartTag()`
    `protected void` | `endElement(JRPrintElement element)`
    `protected void` | `endImage()`
    `protected void` | `endPage()`
    `protected void` | `endPageAnchor()`
    `protected void` | `endText()`
    `protected void` | `init(com.lowagie.text.pdf.PdfContentByte pdfContentByte)`
    `protected void` | `setLanguage(java.lang.String language)`
    `protected void` | `setPdfWriter(com.lowagie.text.pdf.PdfWriter pdfWriter)`
    `protected void` | `setTagged(boolean isTagged)`
    `protected void` | `startElement(JRPrintElement element)`
    `protected void` | `startImage(JRPrintImage printImage)`
    `protected void` | `startPage()`
    `protected void` | `startPageAnchor()`
    `protected void` | `startText()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROPERTY_TAG_TABLE

          public static final java.lang.String PROPERTY_TAG_TABLE

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_TR

          public static final java.lang.String PROPERTY_TAG_TR

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_TH

          public static final java.lang.String PROPERTY_TAG_TH

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_TD

          public static final java.lang.String PROPERTY_TAG_TD

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_H1

          public static final java.lang.String PROPERTY_TAG_H1

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_H2

          public static final java.lang.String PROPERTY_TAG_H2

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_H3

          public static final java.lang.String PROPERTY_TAG_H3

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_COLSPAN

          public static final java.lang.String PROPERTY_TAG_COLSPAN

      See Also:
        Constant Field Values

    - #### PROPERTY_TAG_ROWSPAN

          public static final java.lang.String PROPERTY_TAG_ROWSPAN

      See Also:
        Constant Field Values

    - #### TAG_START

          public static final java.lang.String TAG_START

      See Also:
        Constant Field Values

    - #### TAG_END

          public static final java.lang.String TAG_END

      See Also:
        Constant Field Values

    - #### TAG_FULL

          public static final java.lang.String TAG_FULL

      See Also:
        Constant Field Values

    - #### exporter

          protected JRPdfExporter exporter

    - #### pdfContentByte

          protected com.lowagie.text.pdf.PdfContentByte pdfContentByte

    - #### pdfWriter

          protected com.lowagie.text.pdf.PdfWriter pdfWriter

    - #### allTag

          protected com.lowagie.text.pdf.PdfStructureElement allTag

    - #### tagStack

          protected java.util.Stack<com.lowagie.text.pdf.PdfStructureElement> tagStack

    - #### isTagEmpty

          protected boolean isTagEmpty

    - #### crtCrosstabRowY

          protected int crtCrosstabRowY

    - #### crosstabFrameDepth

          protected int crosstabFrameDepth

    - #### isDataCellPrinted

          protected boolean isDataCellPrinted

    - #### isTagged

          protected boolean isTagged

    - #### language

          protected java.lang.String language

  - ### Constructor Detail

    - #### JRPdfExporterTagHelper

          protected JRPdfExporterTagHelper(JRPdfExporter exporter)

  - ### Method Detail

    - #### setTagged

          protected void setTagged(boolean isTagged)

    - #### setLanguage

          protected void setLanguage(java.lang.String language)

    - #### setPdfWriter

          protected void setPdfWriter(com.lowagie.text.pdf.PdfWriter pdfWriter)

    - #### init

          protected void init(com.lowagie.text.pdf.PdfContentByte pdfContentByte)

    - #### startPageAnchor

          protected void startPageAnchor()

    - #### endPageAnchor

          protected void endPageAnchor()

    - #### startPage

          protected void startPage()

    - #### endPage

          protected void endPage()

    - #### startElement

          protected void startElement(JRPrintElement element)

    - #### endElement

          protected void endElement(JRPrintElement element)

    - #### startImage

          protected void startImage(JRPrintImage printImage)

    - #### endImage

          protected void endImage()

    - #### startText

          protected void startText()

    - #### endText

          protected void endText()

    - #### createStartTags

          protected void createStartTags(JRPrintElement element)

    - #### createTableStartTag

          protected void createTableStartTag()

    - #### createTrStartTag

          protected void createTrStartTag()

    - #### createThStartTag

          protected void createThStartTag(JRPrintElement element)

    - #### createTdStartTag

          protected void createTdStartTag(JRPrintElement element)

    - #### createSpanTags

          protected void createSpanTags(JRPrintElement element,
                            com.lowagie.text.pdf.PdfStructureElement parentTag)

    - #### createEndTags

          protected void createEndTags(JRPrintElement element)

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com