/* * $Id: ElementTags.java 4113 2009-12-01 11:08:59Z blowagie $ * * This file is part of the iText project. * Copyright (c) 1998-2009 1T3XT BVBA * Authors: Bruno Lowagie, Paulo Soares, et al. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3 * as published by the Free Software Foundation with the addition of the * following permission added to Section 15 as permitted in Section 7(a): * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY 1T3XT, * 1T3XT DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License * along with this program; if not, see http://www.gnu.org/licenses or write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA, 02110-1301 USA, or download the license from the following URL: * http://itextpdf.com/terms-of-use/ * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License. * * In accordance with Section 7(b) of the GNU Affero General Public License, * you must retain the producer line in every PDF that is created or manipulated * using iText. * * You can be released from the requirements of the license by purchasing * a commercial license. Buying such a license is mandatory as soon as you * develop commercial activities involving the iText software without * disclosing the source code of your own applications. * These activities include: offering paid services to customers as an ASP, * serving PDFs on the fly in a web application, shipping iText with a closed * source product. * * For more information, please contact iText Software Corp. at this * address: sales@itextpdf.com */ package com.itextpdf.text; /** * A class that contains all the possible tagnames and their attributes. */ public class ElementTags { /** the root tag. */ public static final String ITEXT = "itext"; /** attribute of the root and annotation tag (also a special tag within a chapter or section) */ public static final String TITLE = "title"; /** attribute of the root tag */ public static final String SUBJECT = "subject"; /** attribute of the root tag */ public static final String KEYWORDS = "keywords"; /** attribute of the root tag */ public static final String AUTHOR = "author"; /** attribute of the root tag */ public static final String CREATIONDATE = "creationdate"; /** attribute of the root tag */ public static final String PRODUCER = "producer"; // Chapters and Sections /** the chapter tag */ public static final String CHAPTER = "chapter"; /** the section tag */ public static final String SECTION = "section"; /** attribute of section/chapter tag */ public static final String NUMBERDEPTH = "numberdepth"; /** attribute of section/chapter tag */ public static final String DEPTH = "depth"; /** attribute of section/chapter tag */ public static final String NUMBER = "number"; /** attribute of section/chapter tag */ public static final String INDENT = "indent"; /** attribute of chapter/section/paragraph/table/cell tag */ public static final String LEFT = "left"; /** attribute of chapter/section/paragraph/table/cell tag */ public static final String RIGHT = "right"; // Phrases, Anchors, Lists and Paragraphs /** the phrase tag */ public static final String PHRASE = "phrase"; /** the anchor tag */ public static final String ANCHOR = "anchor"; /** the list tag */ public static final String LIST = "list"; /** the listitem tag */ public static final String LISTITEM = "listitem"; /** the paragraph tag */ public static final String PARAGRAPH = "paragraph"; /** attribute of phrase/paragraph/cell tag */ public static final String LEADING = "leading"; /** attribute of paragraph/image/table tag */ public static final String ALIGN = "align"; /** attribute of paragraph */ public static final String KEEPTOGETHER = "keeptogether"; /** attribute of anchor tag */ public static final String NAME = "name"; /** attribute of anchor tag */ public static final String REFERENCE = "reference"; /** attribute of list tag */ public static final String LISTSYMBOL = "listsymbol"; /** attribute of list tag */ public static final String NUMBERED = "numbered"; /** attribute of the list tag */ public static final String LETTERED = "lettered"; /** attribute of list tag */ public static final String FIRST = "first"; /** attribute of list tag */ public static final String SYMBOLINDENT = "symbolindent"; /** attribute of list tag */ public static final String INDENTATIONLEFT = "indentationleft"; /** attribute of list tag */ public static final String INDENTATIONRIGHT = "indentationright"; // Chunks /** the chunk tag */ public static final String IGNORE = "ignore"; /** the chunk tag */ public static final String ENTITY = "entity"; /** the chunk tag */ public static final String ID = "id"; /** the chunk tag */ public static final String CHUNK = "chunk"; /** attribute of the chunk tag */ public static final String ENCODING = "encoding"; /** attribute of the chunk tag */ public static final String EMBEDDED = "embedded"; /** attribute of the chunk/table/cell tag */ public static final String COLOR = "color"; /** attribute of the chunk/table/cell tag */ public static final String RED = "red"; /** attribute of the chunk/table/cell tag */ public static final String GREEN = "green"; /** attribute of the chunk/table/cell tag */ public static final String BLUE = "blue"; /** attribute of the chunk tag */ public static final String SUBSUPSCRIPT = Chunk.SUBSUPSCRIPT.toLowerCase(); /** attribute of the chunk tag */ public static final String LOCALGOTO = Chunk.LOCALGOTO.toLowerCase(); /** attribute of the chunk tag */ public static final String REMOTEGOTO = Chunk.REMOTEGOTO.toLowerCase(); /** attribute of the chunk tag */ public static final String LOCALDESTINATION = Chunk.LOCALDESTINATION.toLowerCase(); /** attribute of the chunk tag */ public static final String GENERICTAG = Chunk.GENERICTAG.toLowerCase(); // tables/cells /** the table tag */ public static final String TABLE = "table"; /** the cell tag */ public static final String ROW = "row"; /** the cell tag */ public static final String CELL = "cell"; /** attribute of the table tag */ public static final String COLUMNS = "columns"; /** attribute of the table tag */ public static final String LASTHEADERROW = "lastHeaderRow"; /** attribute of the table tag */ public static final String CELLPADDING = "cellpadding"; /** attribute of the table tag */ public static final String CELLSPACING = "cellspacing"; /** attribute of the table tag */ public static final String OFFSET = "offset"; /** attribute of the table tag */ public static final String WIDTHS = "widths"; /** attribute of the table tag */ public static final String TABLEFITSPAGE = "tablefitspage"; /** attribute of the table tag */ public static final String CELLSFITPAGE = "cellsfitpage"; /** attribute of the table tag */ public static final String CONVERT2PDFP = "convert2pdfp"; /** attribute of the cell tag */ public static final String HORIZONTALALIGN = "horizontalalign"; /** attribute of the cell tag */ public static final String VERTICALALIGN = "verticalalign"; /** attribute of the cell tag */ public static final String COLSPAN = "colspan"; /** attribute of the cell tag */ public static final String ROWSPAN = "rowspan"; /** attribute of the cell tag */ public static final String HEADER = "header"; /** attribute of the cell tag */ public static final String NOWRAP = "nowrap"; /** attribute of the table/cell tag */ public static final String BORDERWIDTH = "borderwidth"; /** attribute of the table/cell tag */ public static final String TOP = "top"; /** attribute of the table/cell tag */ public static final String BOTTOM = "bottom"; /** attribute of the table/cell tag */ public static final String WIDTH = "width"; /** attribute of the table/cell tag */ public static final String BORDERCOLOR = "bordercolor"; /** attribute of the table/cell tag */ public static final String BACKGROUNDCOLOR = "backgroundcolor"; /** attribute of the table/cell tag */ public static final String BGRED = "bgred"; /** attribute of the table/cell tag */ public static final String BGGREEN = "bggreen"; /** attribute of the table/cell tag */ public static final String BGBLUE = "bgblue"; /** attribute of the table/cell tag */ public static final String GRAYFILL = "grayfill"; // Misc /** the image tag */ public static final String IMAGE = "image"; /** attribute of the image and annotation tag */ public static final String URL = "url"; /** attribute of the image tag */ public static final String UNDERLYING = "underlying"; /** attribute of the image tag */ public static final String TEXTWRAP = "textwrap"; /** attribute of the image tag */ public static final String ALT = "alt"; /** attribute of the image tag */ public static final String ABSOLUTEX = "absolutex"; /** attribute of the image tag */ public static final String ABSOLUTEY = "absolutey"; /** attribute of the image tag */ public static final String PLAINWIDTH = "plainwidth"; /** attribute of the image tag */ public static final String PLAINHEIGHT = "plainheight"; /** attribute of the image tag */ public static final String SCALEDWIDTH = "scaledwidth"; /** attribute of the image tag */ public static final String SCALEDHEIGHT = "scaledheight"; /** attribute of the image tag */ public static final String ROTATION = "rotation"; /** the newpage tag */ public static final String NEWPAGE = "newpage"; /** the newpage tag */ public static final String NEWLINE = "newline"; /** the annotation tag */ public static final String ANNOTATION = "annotation"; /** attribute of the annotation tag */ public static final String FILE = "file"; /** attribute of the annotation tag */ public static final String DESTINATION = "destination"; /** attribute of the annotation tag */ public static final String PAGE = "page"; /** attribute of the annotation tag */ public static final String NAMED = "named"; /** attribute of the annotation tag */ public static final String APPLICATION = "application"; /** attribute of the annotation tag */ public static final String PARAMETERS = "parameters"; /** attribute of the annotation tag */ public static final String OPERATION = "operation"; /** attribute of the annotation tag */ public static final String DEFAULTDIR = "defaultdir"; /** attribute of the annotation tag */ public static final String LLX = "llx"; /** attribute of the annotation tag */ public static final String LLY = "lly"; /** attribute of the annotation tag */ public static final String URX = "urx"; /** attribute of the annotation tag */ public static final String URY = "ury"; /** attribute of the annotation tag */ public static final String CONTENT = "content"; // alignment attribute values /** the possible value of an alignment attribute */ public static final String ALIGN_LEFT = "Left"; /** the possible value of an alignment attribute */ public static final String ALIGN_CENTER = "Center"; /** the possible value of an alignment attribute */ public static final String ALIGN_RIGHT = "Right"; /** the possible value of an alignment attribute */ public static final String ALIGN_JUSTIFIED = "Justify"; /** the possible value of an alignment attribute */ public static final String ALIGN_JUSTIFIED_ALL = "JustifyAll"; /** the possible value of an alignment attribute */ public static final String ALIGN_TOP = "Top"; /** the possible value of an alignment attribute */ public static final String ALIGN_MIDDLE = "Middle"; /** the possible value of an alignment attribute */ public static final String ALIGN_BOTTOM = "Bottom"; /** the possible value of an alignment attribute */ public static final String ALIGN_BASELINE = "Baseline"; /** the possible value of an alignment attribute */ public static final String DEFAULT = "Default"; /** the possible value of an alignment attribute */ public static final String UNKNOWN = "unknown"; /** the possible value of an alignment attribute */ public static final String FONT = "font"; /** the possible value of an alignment attribute */ public static final String SIZE = "size"; /** the possible value of an alignment attribute */ public static final String STYLE = "fontstyle"; /** the possible value of a tag */ public static final String HORIZONTALRULE = "horizontalrule"; /** the possible value of a tag */ public static final String PAGE_SIZE = "pagesize"; /** the possible value of a tag */ public static final String ORIENTATION = "orientation"; /** a possible list attribute */ public static final String ALIGN_INDENTATION_ITEMS = "alignindent"; /** a possible list attribute */ public static final String AUTO_INDENT_ITEMS = "autoindent"; /** a possible list attribute */ public static final String LOWERCASE = "lowercase"; /** * a possible list attribute * @since 2.1.3 */ public static final String FACE = "face"; /** attribute of the image or iframe tag * @since 2.1.3 */ public static final String SRC = "src"; // methods /** * Translates the alignment value to a String value. * * @param alignment the alignment value * @return the translated value */ public static String getAlignment(int alignment) { switch(alignment) { case Element.ALIGN_LEFT: return ALIGN_LEFT; case Element.ALIGN_CENTER: return ALIGN_CENTER; case Element.ALIGN_RIGHT: return ALIGN_RIGHT; case Element.ALIGN_JUSTIFIED: case Element.ALIGN_JUSTIFIED_ALL: return ALIGN_JUSTIFIED; case Element.ALIGN_TOP: return ALIGN_TOP; case Element.ALIGN_MIDDLE: return ALIGN_MIDDLE; case Element.ALIGN_BOTTOM: return ALIGN_BOTTOM; case Element.ALIGN_BASELINE: return ALIGN_BASELINE; default: return DEFAULT; } } /** * Translates a String value to an alignment value. * (written by Norman Richards, integrated into iText by Bruno) * @param alignment a String (one of the ALIGN_ constants of this class) * @return an alignment value (one of the ALIGN_ constants of the Element interface) */ public static int alignmentValue(String alignment) { if (alignment == null) return Element.ALIGN_UNDEFINED; if (ALIGN_CENTER.equalsIgnoreCase(alignment)) { return Element.ALIGN_CENTER; } if (ALIGN_LEFT.equalsIgnoreCase(alignment)) { return Element.ALIGN_LEFT; } if (ALIGN_RIGHT.equalsIgnoreCase(alignment)) { return Element.ALIGN_RIGHT; } if (ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) { return Element.ALIGN_JUSTIFIED; } if (ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) { return Element.ALIGN_JUSTIFIED_ALL; } if (ALIGN_TOP.equalsIgnoreCase(alignment)) { return Element.ALIGN_TOP; } if (ALIGN_MIDDLE.equalsIgnoreCase(alignment)) { return Element.ALIGN_MIDDLE; } if (ALIGN_BOTTOM.equalsIgnoreCase(alignment)) { return Element.ALIGN_BOTTOM; } if (ALIGN_BASELINE.equalsIgnoreCase(alignment)) { return Element.ALIGN_BASELINE; } return Element.ALIGN_UNDEFINED; } }