2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
19 import org.apache.pdfbox.cos.COSArray;
20 import org.apache.pdfbox.cos.COSBase;
21 import org.apache.pdfbox.cos.COSDictionary;
22 import org.apache.pdfbox.pdmodel.common.PDRectangle;
23 import org.apache.pdfbox.pdmodel.graphics.color.PDGamma;
26 * A Layout attribute object.
28 * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
29 * @version $Revision: $
31 public class PDLayoutAttributeObject extends PDStandardAttributeObject
35 * standard attribute owner: Layout
37 public static final String OWNER_LAYOUT = "Layout";
39 private static final String PLACEMENT = "Placement";
40 private static final String WRITING_MODE = "WritingMode";
41 private static final String BACKGROUND_COLOR = "BackgroundColor";
42 private static final String BORDER_COLOR = "BorderColor";
43 private static final String BORDER_STYLE = "BorderStyle";
44 private static final String BORDER_THICKNESS = "BorderThickness";
45 private static final String PADDING = "Padding";
46 private static final String COLOR = "Color";
47 private static final String SPACE_BEFORE = "SpaceBefore";
48 private static final String SPACE_AFTER = "SpaceAfter";
49 private static final String START_INDENT = "StartIndent";
50 private static final String END_INDENT = "EndIndent";
51 private static final String TEXT_INDENT = "TextIndent";
52 private static final String TEXT_ALIGN = "TextAlign";
53 private static final String BBOX = "BBox";
54 private static final String WIDTH = "Width";
55 private static final String HEIGHT = "Height";
56 private static final String BLOCK_ALIGN = "BlockAlign";
57 private static final String INLINE_ALIGN = "InlineAlign";
58 private static final String T_BORDER_STYLE = "TBorderStyle";
59 private static final String T_PADDING = "TPadding";
60 private static final String BASELINE_SHIFT = "BaselineShift";
61 private static final String LINE_HEIGHT = "LineHeight";
62 private static final String TEXT_DECORATION_COLOR = "TextDecorationColor";
63 private static final String TEXT_DECORATION_THICKNESS = "TextDecorationThickness";
64 private static final String TEXT_DECORATION_TYPE = "TextDecorationType";
65 private static final String RUBY_ALIGN = "RubyAlign";
66 private static final String RUBY_POSITION = "RubyPosition";
67 private static final String GLYPH_ORIENTATION_VERTICAL = "GlyphOrientationVertical";
68 private static final String COLUMN_COUNT = "ColumnCount";
69 private static final String COLUMN_GAP = "ColumnGap";
70 private static final String COLUMN_WIDTHS = "ColumnWidths";
73 * Placement: Block: Stacked in the block-progression direction within an
74 * enclosing reference area or parent BLSE.
76 public static final String PLACEMENT_BLOCK = "Block";
78 * Placement: Inline: Packed in the inline-progression direction within an
81 public static final String PLACEMENT_INLINE = "Inline";
83 * Placement: Before: Placed so that the before edge of the element’s
84 * allocation rectangle coincides with that of the nearest enclosing
85 * reference area. The element may float, if necessary, to achieve the
86 * specified placement. The element shall be treated as a block occupying
87 * the full extent of the enclosing reference area in the inline direction.
88 * Other content shall be stacked so as to begin at the after edge of the
89 * element’s allocation rectangle.
91 public static final String PLACEMENT_BEFORE = "Before";
93 * Placement: Start: Placed so that the start edge of the element’s
94 * allocation rectangle coincides with that of the nearest enclosing
95 * reference area. The element may float, if necessary, to achieve the
96 * specified placement. Other content that would intrude into the element’s
97 * allocation rectangle shall be laid out as a runaround.
99 public static final String PLACEMENT_START = "Start";
101 * Placement: End: Placed so that the end edge of the element’s allocation
102 * rectangle coincides with that of the nearest enclosing reference area.
103 * The element may float, if necessary, to achieve the specified placement.
104 * Other content that would intrude into the element’s allocation rectangle
105 * shall be laid out as a runaround.
107 public static final String PLACEMENT_END = "End";
109 * WritingMode: LrTb: Inline progression from left to right; block
110 * progression from top to bottom. This is the typical writing mode for
111 * Western writing systems.
113 public static final String WRITING_MODE_LRTB = "LrTb";
115 * WritingMode: RlTb: Inline progression from right to left; block
116 * progression from top to bottom. This is the typical writing mode for
117 * Arabic and Hebrew writing systems.
119 public static final String WRITING_MODE_RLTB = "RlTb";
121 * WritingMode: TbRl: Inline progression from top to bottom; block
122 * progression from right to left. This is the typical writing mode for
123 * Chinese and Japanese writing systems.
125 public static final String WRITING_MODE_TBRL = "TbRl";
127 * BorderStyle: None: No border. Forces the computed value of
128 * BorderThickness to be 0.
130 public static final String BORDER_STYLE_NONE = "None";
132 * BorderStyle: Hidden: Same as {@link #BORDER_STYLE_NONE}, except in terms
133 * of border conflict resolution for table elements.
135 public static final String BORDER_STYLE_HIDDEN = "Hidden";
137 * BorderStyle: Dotted: The border is a series of dots.
139 public static final String BORDER_STYLE_DOTTED = "Dotted";
141 * BorderStyle: Dashed: The border is a series of short line segments.
143 public static final String BORDER_STYLE_DASHED = "Dashed";
145 * BorderStyle: Solid: The border is a single line segment.
147 public static final String BORDER_STYLE_SOLID = "Solid";
149 * BorderStyle: Double: The border is two solid lines. The sum of the two
150 * lines and the space between them equals the value of BorderThickness.
152 public static final String BORDER_STYLE_DOUBLE = "Double";
154 * BorderStyle: Groove: The border looks as though it were carved into the
157 public static final String BORDER_STYLE_GROOVE = "Groove";
159 * BorderStyle: Ridge: The border looks as though it were coming out of the
160 * canvas (the opposite of {@link #BORDER_STYLE_GROOVE}).
162 public static final String BORDER_STYLE_RIDGE = "Ridge";
164 * BorderStyle: Inset: The border makes the entire box look as though it
165 * were embedded in the canvas.
167 public static final String BORDER_STYLE_INSET = "Inset";
169 * BorderStyle: Outset: The border makes the entire box look as though it
170 * were coming out of the canvas (the opposite of {@link #BORDER_STYLE_INSET}.
172 public static final String BORDER_STYLE_OUTSET = "Outset";
174 * TextAlign: Start: Aligned with the start edge.
176 public static final String TEXT_ALIGN_START = "Start";
178 * TextAlign: Center: Centered between the start and end edges.
180 public static final String TEXT_ALIGN_CENTER = "Center";
182 * TextAlign: End: Aligned with the end edge.
184 public static final String TEXT_ALIGN_END = "End";
186 * TextAlign: Justify: Aligned with both the start and end edges, with
187 * internal spacing within each line expanded, if necessary, to achieve such
188 * alignment. The last (or only) line shall be aligned with the start edge
191 public static final String TEXT_ALIGN_JUSTIFY = "Justify";
195 public static final String WIDTH_AUTO = "Auto";
199 public static final String HEIGHT_AUTO = "Auto";
201 * BlockAlign: Before: Before edge of the first child’s allocation rectangle
202 * aligned with that of the table cell’s content rectangle.
204 public static final String BLOCK_ALIGN_BEFORE = "Before";
206 * BlockAlign: Middle: Children centered within the table cell. The distance
207 * between the before edge of the first child’s allocation rectangle and
208 * that of the table cell’s content rectangle shall be the same as the
209 * distance between the after edge of the last child’s allocation rectangle
210 * and that of the table cell’s content rectangle.
212 public static final String BLOCK_ALIGN_MIDDLE = "Middle";
214 * BlockAlign: After: After edge of the last child’s allocation rectangle
215 * aligned with that of the table cell’s content rectangle.
217 public static final String BLOCK_ALIGN_AFTER = "After";
219 * BlockAlign: Justify: Children aligned with both the before and after
220 * edges of the table cell’s content rectangle. The first child shall be
221 * placed as described for {@link #BLOCK_ALIGN_BEFORE} and the last child as
222 * described for {@link #BLOCK_ALIGN_AFTER}, with equal spacing between the
223 * children. If there is only one child, it shall be aligned with the before
224 * edge only, as for {@link #BLOCK_ALIGN_BEFORE}.
226 public static final String BLOCK_ALIGN_JUSTIFY = "Justify";
228 * InlineAlign: Start: Start edge of each child’s allocation rectangle
229 * aligned with that of the table cell’s content rectangle.
231 public static final String INLINE_ALIGN_START = "Start";
233 * InlineAlign: Center: Each child centered within the table cell. The
234 * distance between the start edges of the child’s allocation rectangle and
235 * the table cell’s content rectangle shall be the same as the distance
236 * between their end edges.
238 public static final String INLINE_ALIGN_CENTER = "Center";
240 * InlineAlign: End: End edge of each child’s allocation rectangle aligned
241 * with that of the table cell’s content rectangle.
243 public static final String INLINE_ALIGN_END = "End";
245 * LineHeight: NormalAdjust the line height to include any nonzero value
246 * specified for BaselineShift.
248 public static final String LINE_HEIGHT_NORMAL = "Normal";
250 * LineHeight: Auto: Adjustment for the value of BaselineShift shall not be
253 public static final String LINE_HEIGHT_AUTO = "Auto";
255 * TextDecorationType: None: No text decoration
257 public static final String TEXT_DECORATION_TYPE_NONE = "None";
259 * TextDecorationType: Underline: A line below the text
261 public static final String TEXT_DECORATION_TYPE_UNDERLINE = "Underline";
263 * TextDecorationType: Overline: A line above the text
265 public static final String TEXT_DECORATION_TYPE_OVERLINE = "Overline";
267 * TextDecorationType: LineThrough: A line through the middle of the text
269 public static final String TEXT_DECORATION_TYPE_LINE_THROUGH = "LineThrough";
271 * RubyAlign: Start: The content shall be aligned on the start edge in the
272 * inline-progression direction.
274 public static final String RUBY_ALIGN_START = "Start";
276 * RubyAlign: Center: The content shall be centered in the
277 * inline-progression direction.
279 public static final String RUBY_ALIGN_CENTER = "Center";
281 * RubyAlign: End: The content shall be aligned on the end edge in the
282 * inline-progression direction.
284 public static final String RUBY_ALIGN_END = "End";
286 * RubyAlign: Justify: The content shall be expanded to fill the available
287 * width in the inline-progression direction.
289 public static final String RUBY_ALIGN_JUSTIFY = "Justify";
291 * RubyAlign: Distribute: The content shall be expanded to fill the
292 * available width in the inline-progression direction. However, space shall
293 * also be inserted at the start edge and end edge of the text. The spacing
294 * shall be distributed using a 1:2:1 (start:infix:end) ratio. It shall be
295 * changed to a 0:1:1 ratio if the ruby appears at the start of a text line
296 * or to a 1:1:0 ratio if the ruby appears at the end of the text line.
298 public static final String RUBY_ALIGN_DISTRIBUTE = "Distribute";
300 * RubyPosition: Before: The RT content shall be aligned along the before
301 * edge of the element.
303 public static final String RUBY_POSITION_BEFORE = "Before";
305 * RubyPosition: After: The RT content shall be aligned along the after edge
308 public static final String RUBY_POSITION_AFTER = "After";
310 * RubyPosition: Warichu: The RT and associated RP elements shall be
311 * formatted as a warichu, following the RB element.
313 public static final String RUBY_POSITION_WARICHU = "Warichu";
315 * RubyPosition: Inline: The RT and associated RP elements shall be
316 * formatted as a parenthesis comment, following the RB element.
318 public static final String RUBY_POSITION_INLINE = "Inline";
320 * GlyphOrientationVertical: Auto
322 public static final String GLYPH_ORIENTATION_VERTICAL_AUTO = "Auto";
324 * GlyphOrientationVertical: -180°
326 public static final String GLYPH_ORIENTATION_VERTICAL_MINUS_180_DEGREES = "-180";
328 * GlyphOrientationVertical: -90°
330 public static final String GLYPH_ORIENTATION_VERTICAL_MINUS_90_DEGREES = "-90";
332 * GlyphOrientationVertical: 0°
334 public static final String GLYPH_ORIENTATION_VERTICAL_ZERO_DEGREES = "0";
336 * GlyphOrientationVertical: 90°
338 public static final String GLYPH_ORIENTATION_VERTICAL_90_DEGREES = "90";
340 * GlyphOrientationVertical: 180°
342 public static final String GLYPH_ORIENTATION_VERTICAL_180_DEGREES = "180";
344 * GlyphOrientationVertical: 270°
346 public static final String GLYPH_ORIENTATION_VERTICAL_270_DEGREES = "270";
348 * GlyphOrientationVertical: 360°
350 public static final String GLYPH_ORIENTATION_VERTICAL_360_DEGREES = "360";
354 * Default constructor.
356 public PDLayoutAttributeObject()
358 this.setOwner(OWNER_LAYOUT);
362 * Creates a new Layout attribute object with a given dictionary.
364 * @param dictionary the dictionary
366 public PDLayoutAttributeObject(COSDictionary dictionary)
373 * Gets the positioning of the element with respect to the enclosing
374 * reference area and other content (Placement). The default value is
375 * {@link #PLACEMENT_INLINE}.
377 * @return the placement
379 public String getPlacement()
381 return this.getName(PLACEMENT, PLACEMENT_INLINE);
385 * Sets the positioning of the element with respect to the enclosing
386 * reference area and other content (Placement). The value should be one of:
388 * <li>{@link #PLACEMENT_BLOCK},</li>
389 * <li>{@link #PLACEMENT_INLINE},</li>
390 * <li>{@link #PLACEMENT_BEFORE},</li>
391 * <li>{@link #PLACEMENT_START},</li>
392 * <li>{@link #PLACEMENT_END}.</li>
395 * @param placement the placement
397 public void setPlacement(String placement)
399 this.setName(PLACEMENT, placement);
403 * Gets the writing mode (WritingMode). The default value is
404 * {@link #WRITING_MODE_LRTB}.
406 * @return the writing mode
408 public String getWritingMode()
410 return this.getName(WRITING_MODE, WRITING_MODE_LRTB);
414 * Sets the writing mode (WritingMode). The value should be one of:
416 * <li>{@link #WRITING_MODE_LRTB},</li>
417 * <li>{@link #WRITING_MODE_RLTB},</li>
418 * <li>{@link #WRITING_MODE_TBRL}.</li>
421 * @param writingMode the writing mode
423 public void setWritingMode(String writingMode)
425 this.setName(WRITING_MODE, writingMode);
429 * Gets the background colour (BackgroundColor).
431 * @return the background colour
433 public PDGamma getBackgroundColor()
435 return this.getColor(BACKGROUND_COLOR);
439 * Sets the background colour (BackgroundColor).
441 * @param backgroundColor the background colour
443 public void setBackgroundColor(PDGamma backgroundColor)
445 this.setColor(BACKGROUND_COLOR, backgroundColor);
449 * Gets the border colour (BorderColor).
451 * @return a single border colour ({@link PDGamma}) or four border colours
452 * ({@link PDFourColours})
454 public Object getBorderColors()
456 return this.getColorOrFourColors(BORDER_COLOR);
460 * Sets the same border colour for all four sides (BorderColor).
462 * @param borderColor the border colour
464 public void setAllBorderColors(PDGamma borderColor)
466 this.setColor(BORDER_COLOR, borderColor);
470 * Sets the border colours for four sides separately (BorderColor).
472 * @param borderColors the border colours
474 public void setBorderColors(PDFourColours borderColors)
476 this.setFourColors(BORDER_COLOR, borderColors);
480 * Gets the border style (BorderStyle). The default value is
481 * {@link #BORDER_STYLE_NONE}.
483 * @return the border styles (a String or an array of four Strings)
485 public Object getBorderStyle()
487 return this.getNameOrArrayOfName(BORDER_STYLE, BORDER_STYLE_NONE);
491 * Sets the same border style for all four sides (BorderStyle). The value
494 * <li>{@link #BORDER_STYLE_NONE},</li>
495 * <li>{@link #BORDER_STYLE_HIDDEN},</li>
496 * <li>{@link #BORDER_STYLE_DOTTED},</li>
497 * <li>{@link #BORDER_STYLE_DASHED},</li>
498 * <li>{@link #BORDER_STYLE_SOLID},</li>
499 * <li>{@link #BORDER_STYLE_DOUBLE},</li>
500 * <li>{@link #BORDER_STYLE_GROOVE},</li>
501 * <li>{@link #BORDER_STYLE_RIDGE},</li>
502 * <li>{@link #BORDER_STYLE_INSET},</li>
503 * <li>{@link #BORDER_STYLE_OUTSET}.</li>
506 * @param borderStyle the border style
508 public void setAllBorderStyles(String borderStyle)
510 this.setName(BORDER_STYLE, borderStyle);
514 * Sets the border styles for four sides separately (BorderStyle). The
515 * values should be of:
517 * <li>{@link #BORDER_STYLE_NONE},</li>
518 * <li>{@link #BORDER_STYLE_HIDDEN},</li>
519 * <li>{@link #BORDER_STYLE_DOTTED},</li>
520 * <li>{@link #BORDER_STYLE_DASHED},</li>
521 * <li>{@link #BORDER_STYLE_SOLID},</li>
522 * <li>{@link #BORDER_STYLE_DOUBLE},</li>
523 * <li>{@link #BORDER_STYLE_GROOVE},</li>
524 * <li>{@link #BORDER_STYLE_RIDGE},</li>
525 * <li>{@link #BORDER_STYLE_INSET},</li>
526 * <li>{@link #BORDER_STYLE_OUTSET}.</li>
529 * @param borderStyles the border styles (an array of four Strings)
531 public void setBorderStyles(String[] borderStyles)
533 this.setArrayOfName(BORDER_STYLE, borderStyles);
537 * Gets the border thickness (BorderThickness).
539 * @return the border thickness (a Float or an array of four floats)
541 public Object getBorderThickness()
543 return this.getNumberOrArrayOfNumber(BORDER_THICKNESS, UNSPECIFIED);
547 * Sets the same border thickness for all four sides (BorderThickness).
549 * @param borderThickness the border thickness
551 public void setAllBorderThicknesses(float borderThickness)
553 this.setNumber(BORDER_THICKNESS, borderThickness);
557 * Sets the same border thickness for all four sides (BorderThickness).
559 * @param borderThickness the border thickness
561 public void setAllBorderThicknesses(int borderThickness)
563 this.setNumber(BORDER_THICKNESS, borderThickness);
567 * Sets the border thicknesses for four sides separately (BorderThickness).
569 * @param borderThicknesses the border thickness (an array of four floats)
571 public void setBorderThicknesses(float[] borderThicknesses)
573 this.setArrayOfNumber(BORDER_THICKNESS, borderThicknesses);
577 * Gets the padding (Padding). The default value is 0.
579 * @return the padding (a Float or an array of float)
581 public Object getPadding()
583 return this.getNumberOrArrayOfNumber(PADDING, 0.f);
587 * Sets the same padding for all four sides (Padding).
589 * @param padding the padding
591 public void setAllPaddings(float padding)
593 this.setNumber(PADDING, padding);
597 * Sets the same padding for all four sides (Padding).
599 * @param padding the padding
601 public void setAllPaddings(int padding)
603 this.setNumber(PADDING, padding);
607 * Sets the paddings for four sides separately (Padding).
609 * @param paddings the paddings (an array of four floats)
611 public void setPaddings(float[] paddings)
613 this.setArrayOfNumber(PADDING, paddings);
617 * Gets the color to be used for drawing text and the default value for the
618 * colour of table borders and text decorations (Color).
622 public PDGamma getColor()
624 return this.getColor(COLOR);
628 * Sets the color to be used for drawing text and the default value for the
629 * colour of table borders and text decorations (Color).
631 * @param color the colour
633 public void setColor(PDGamma color)
635 this.setColor(COLOR, color);
639 * Gets the amount of extra space preceding the before edge of the BLSE in
640 * the block-progression direction (SpaceBefore). The default value is 0.
642 * @return the space before
644 public float getSpaceBefore()
646 return this.getNumber(SPACE_BEFORE, 0.f);
650 * Sets the amount of extra space preceding the before edge of the BLSE in
651 * the block-progression direction (SpaceBefore).
653 * @param spaceBefore the space before
655 public void setSpaceBefore(float spaceBefore)
657 this.setNumber(SPACE_BEFORE, spaceBefore);
661 * Sets the amount of extra space preceding the before edge of the BLSE in
662 * the block-progression direction (SpaceBefore).
664 * @param spaceBefore the space before
666 public void setSpaceBefore(int spaceBefore)
668 this.setNumber(SPACE_BEFORE, spaceBefore);
672 * Gets the amount of extra space following the after edge of the BLSE in
673 * the block-progression direction (SpaceAfter). The default value is 0.
675 * @return the space after
677 public float getSpaceAfter()
679 return this.getNumber(SPACE_AFTER, 0.f);
683 * Sets the amount of extra space following the after edge of the BLSE in
684 * the block-progression direction (SpaceAfter).
686 * @param spaceAfter the space after
688 public void setSpaceAfter(float spaceAfter)
690 this.setNumber(SPACE_AFTER, spaceAfter);
694 * Sets the amount of extra space following the after edge of the BLSE in
695 * the block-progression direction (SpaceAfter).
697 * @param spaceAfter the space after
699 public void setSpaceAfter(int spaceAfter)
701 this.setNumber(SPACE_AFTER, spaceAfter);
705 * Gets the distance from the start edge of the reference area to that of
706 * the BLSE in the inline-progression direction (StartIndent). The default value is 0.
708 * @return the start indent
710 public float getStartIndent()
712 return this.getNumber(START_INDENT, 0.f);
716 * Sets the distance from the start edge of the reference area to that of
717 * the BLSE in the inline-progression direction (StartIndent).
719 * @param startIndent the start indent
721 public void setStartIndent(float startIndent)
723 this.setNumber(START_INDENT, startIndent);
727 * Sets the distance from the start edge of the reference area to that of
728 * the BLSE in the inline-progression direction (StartIndent).
730 * @param startIndent the start indent
732 public void setStartIndent(int startIndent)
734 this.setNumber(START_INDENT, startIndent);
738 * Gets the distance from the end edge of the BLSE to that of the reference
739 * area in the inline-progression direction (EndIndent). The default value
742 * @return the end indent
744 public float getEndIndent()
746 return this.getNumber(END_INDENT, 0.f);
750 * Sets the distance from the end edge of the BLSE to that of the reference
751 * area in the inline-progression direction (EndIndent).
753 * @param endIndent the end indent
755 public void setEndIndent(float endIndent)
757 this.setNumber(END_INDENT, endIndent);
761 * Sets the distance from the end edge of the BLSE to that of the reference
762 * area in the inline-progression direction (EndIndent).
764 * @param endIndent the end indent
766 public void setEndIndent(int endIndent)
768 this.setNumber(END_INDENT, endIndent);
772 * Gets the additional distance in the inline-progression direction from the
773 * start edge of the BLSE, as specified by StartIndent, to that of the first
774 * line of text (TextIndent). The default value is 0.
776 * @return the text indent
778 public float getTextIndent()
780 return this.getNumber(TEXT_INDENT, 0.f);
784 * Sets the additional distance in the inline-progression direction from the
785 * start edge of the BLSE, as specified by StartIndent, to that of the first
786 * line of text (TextIndent).
788 * @param textIndent the text indent
790 public void setTextIndent(float textIndent)
792 this.setNumber(TEXT_INDENT, textIndent);
796 * Sets the additional distance in the inline-progression direction from the
797 * start edge of the BLSE, as specified by StartIndent, to that of the first
798 * line of text (TextIndent).
800 * @param textIndent the text indent
802 public void setTextIndent(int textIndent)
804 this.setNumber(TEXT_INDENT, textIndent);
808 * Gets the alignment, in the inline-progression direction, of text and
809 * other content within lines of the BLSE (TextAlign). The default value is
810 * {@link #TEXT_ALIGN_START}.
812 * @return the text alignment
814 public String getTextAlign()
816 return this.getName(TEXT_ALIGN, TEXT_ALIGN_START);
820 * Sets the alignment, in the inline-progression direction, of text and
821 * other content within lines of the BLSE (TextAlign). The value should be
824 * <li>{@link #TEXT_ALIGN_START},</li>
825 * <li>{@link #TEXT_ALIGN_CENTER},</li>
826 * <li>{@link #TEXT_ALIGN_END},</li>
827 * <li>{@link #TEXT_ALIGN_JUSTIFY}.</li>
830 * @param textIndent the text alignment
832 public void setTextAlign(String textIndent)
834 this.setName(TEXT_ALIGN, textIndent);
838 * Gets the bounding box.
840 * @return the bounding box.
842 public PDRectangle getBBox()
845 (COSArray) this.getCOSDictionary().getDictionaryObject(BBOX);
848 return new PDRectangle(array);
854 * Sets the bounding box.
856 * @param bbox the bounding box
858 public void setBBox(PDRectangle bbox)
861 COSBase oldValue = this.getCOSDictionary().getDictionaryObject(name);
862 this.getCOSDictionary().setItem(name, bbox);
863 COSBase newValue = bbox == null ? null : bbox.getCOSObject();
864 this.potentiallyNotifyChanged(oldValue, newValue);
868 * Gets the width of the element’s content rectangle in the
869 * inline-progression direction (Width). The default value is
870 * {@link #WIDTH_AUTO}.
872 * @return the width (a Float or a String)
874 public Object getWidth()
876 return this.getNumberOrName(WIDTH, WIDTH_AUTO);
880 * Sets the width of the element’s content rectangle in the
881 * inline-progression direction (Width) to {@link #WIDTH_AUTO}.
883 public void setWidthAuto()
885 this.setName(WIDTH, WIDTH_AUTO);
889 * Sets the width of the element’s content rectangle in the
890 * inline-progression direction (Width).
892 * @param width the width
894 public void setWidth(float width)
896 this.setNumber(WIDTH, width);
900 * Sets the width of the element’s content rectangle in the
901 * inline-progression direction (Width).
903 * @param width the width
905 public void setWidth(int width)
907 this.setNumber(WIDTH, width);
911 * Gets the height of the element’s content rectangle in the
912 * block-progression direction (Height). The default value is
913 * {@link #HEIGHT_AUTO}.
915 * @return the height (a Float or a String)
917 public Object getHeight()
919 return this.getNumberOrName(HEIGHT, HEIGHT_AUTO);
923 * Sets the height of the element’s content rectangle in the
924 * block-progression direction (Height) to {@link #HEIGHT_AUTO}.
926 public void setHeightAuto()
928 this.setName(HEIGHT, HEIGHT_AUTO);
932 * Sets the height of the element’s content rectangle in the
933 * block-progression direction (Height).
935 * @param height the height
937 public void setHeight(float height)
939 this.setNumber(HEIGHT, height);
943 * Sets the height of the element’s content rectangle in the
944 * block-progression direction (Height).
946 * @param height the height
948 public void setHeight(int height)
950 this.setNumber(HEIGHT, height);
954 * Gets the alignment, in the block-progression direction, of content within
955 * the table cell (BlockAlign). The default value is
956 * {@link #BLOCK_ALIGN_BEFORE}.
958 * @return the block alignment
960 public String getBlockAlign()
962 return this.getName(BLOCK_ALIGN, BLOCK_ALIGN_BEFORE);
966 * Sets the alignment, in the block-progression direction, of content within
967 * the table cell (BlockAlign). The value should be one of:
969 * <li>{@link #BLOCK_ALIGN_BEFORE},</li>
970 * <li>{@link #BLOCK_ALIGN_MIDDLE},</li>
971 * <li>{@link #BLOCK_ALIGN_AFTER},</li>
972 * <li>{@link #BLOCK_ALIGN_JUSTIFY}.</li>
975 * @param blockAlign the block alignment
977 public void setBlockAlign(String blockAlign)
979 this.setName(BLOCK_ALIGN, blockAlign);
983 * Gets the alignment, in the inline-progression direction, of content
984 * within the table cell (InlineAlign). The default value is
985 * {@link #INLINE_ALIGN_START}.
987 * @return the inline alignment
989 public String getInlineAlign()
991 return this.getName(INLINE_ALIGN, INLINE_ALIGN_START);
995 * Sets the alignment, in the inline-progression direction, of content
996 * within the table cell (InlineAlign). The value should be one of
998 * <li>{@link #INLINE_ALIGN_START},</li>
999 * <li>{@link #INLINE_ALIGN_CENTER},</li>
1000 * <li>{@link #INLINE_ALIGN_END}.</li>
1003 * @param inlineAlign the inline alignment
1005 public void setInlineAlign(String inlineAlign)
1007 this.setName(INLINE_ALIGN, inlineAlign);
1011 * Gets the style of the border drawn on each edge of a table cell
1016 public Object getTBorderStyle()
1018 return this.getNameOrArrayOfName(T_BORDER_STYLE, BORDER_STYLE_NONE);
1022 * Sets the same table border style for all four sides (TBorderStyle). The
1023 * value should be one of:
1025 * <li>{@link #BORDER_STYLE_NONE},</li>
1026 * <li>{@link #BORDER_STYLE_HIDDEN},</li>
1027 * <li>{@link #BORDER_STYLE_DOTTED},</li>
1028 * <li>{@link #BORDER_STYLE_DASHED},</li>
1029 * <li>{@link #BORDER_STYLE_SOLID},</li>
1030 * <li>{@link #BORDER_STYLE_DOUBLE},</li>
1031 * <li>{@link #BORDER_STYLE_GROOVE},</li>
1032 * <li>{@link #BORDER_STYLE_RIDGE},</li>
1033 * <li>{@link #BORDER_STYLE_INSET},</li>
1034 * <li>{@link #BORDER_STYLE_OUTSET}.</li>
1037 * @param tBorderStyle the table border style
1039 public void setAllTBorderStyles(String tBorderStyle)
1041 this.setName(T_BORDER_STYLE, tBorderStyle);
1045 * Sets the style of the border drawn on each edge of a table cell
1046 * (TBorderStyle). The values should be of:
1048 * <li>{@link #BORDER_STYLE_NONE},</li>
1049 * <li>{@link #BORDER_STYLE_HIDDEN},</li>
1050 * <li>{@link #BORDER_STYLE_DOTTED},</li>
1051 * <li>{@link #BORDER_STYLE_DASHED},</li>
1052 * <li>{@link #BORDER_STYLE_SOLID},</li>
1053 * <li>{@link #BORDER_STYLE_DOUBLE},</li>
1054 * <li>{@link #BORDER_STYLE_GROOVE},</li>
1055 * <li>{@link #BORDER_STYLE_RIDGE},</li>
1056 * <li>{@link #BORDER_STYLE_INSET},</li>
1057 * <li>{@link #BORDER_STYLE_OUTSET}.</li>
1060 * @param tBorderStyles
1062 public void setTBorderStyles(String[] tBorderStyles)
1064 this.setArrayOfName(T_BORDER_STYLE, tBorderStyles);
1068 * Gets the offset to account for the separation between the table cell’s
1069 * content rectangle and the surrounding border (TPadding). The default
1072 * @return the table padding (a Float or an array of float)
1074 public Object getTPadding()
1076 return this.getNumberOrArrayOfNumber(T_PADDING, 0.f);
1080 * Sets the same table padding for all four sides (TPadding).
1082 * @param tPadding the table padding
1084 public void setAllTPaddings(float tPadding)
1086 this.setNumber(T_PADDING, tPadding);
1090 * Sets the same table padding for all four sides (TPadding).
1092 * @param tPadding the table padding
1094 public void setAllTPaddings(int tPadding)
1096 this.setNumber(T_PADDING, tPadding);
1100 * Sets the table paddings for four sides separately (TPadding).
1102 * @param tPaddings the table paddings (an array of four floats)
1104 public void setTPaddings(float[] tPaddings)
1106 this.setArrayOfNumber(T_PADDING, tPaddings);
1110 * Gets the distance by which the element’s baseline shall be shifted
1111 * relative to that of its parent element (BaselineShift). The default value
1114 * @return the baseline shift
1116 public float getBaselineShift()
1118 return this.getNumber(BASELINE_SHIFT, 0.f);
1122 * Sets the distance by which the element’s baseline shall be shifted
1123 * relative to that of its parent element (BaselineShift).
1125 * @param baselineShift the baseline shift
1127 public void setBaselineShift(float baselineShift)
1129 this.setNumber(BASELINE_SHIFT, baselineShift);
1133 * Sets the distance by which the element’s baseline shall be shifted
1134 * relative to that of its parent element (BaselineShift).
1136 * @param baselineShift the baseline shift
1138 public void setBaselineShift(int baselineShift)
1140 this.setNumber(BASELINE_SHIFT, baselineShift);
1144 * Gets the element’s preferred height in the block-progression direction
1145 * (LineHeight). The default value is {@link #LINE_HEIGHT_NORMAL}.
1147 * @return the line height (a Float or a String)
1149 public Object getLineHeight()
1151 return this.getNumberOrName(LINE_HEIGHT, LINE_HEIGHT_NORMAL);
1155 * Sets the element’s preferred height in the block-progression direction
1156 * (LineHeight) to {@link #LINE_HEIGHT_NORMAL}.
1158 public void setLineHeightNormal()
1160 this.setName(LINE_HEIGHT, LINE_HEIGHT_NORMAL);
1164 * Sets the element’s preferred height in the block-progression direction
1165 * (LineHeight) to {@link #LINE_HEIGHT_AUTO}.
1167 public void setLineHeightAuto()
1169 this.setName(LINE_HEIGHT, LINE_HEIGHT_AUTO);
1173 * Sets the element’s preferred height in the block-progression direction
1176 * @param lineHeight the line height
1178 public void setLineHeight(float lineHeight)
1180 this.setNumber(LINE_HEIGHT, lineHeight);
1184 * Sets the element’s preferred height in the block-progression direction
1187 * @param lineHeight the line height
1189 public void setLineHeight(int lineHeight)
1191 this.setNumber(LINE_HEIGHT, lineHeight);
1195 * Gets the colour to be used for drawing text decorations
1196 * (TextDecorationColor).
1198 * @return the text decoration colour
1200 public PDGamma getTextDecorationColor()
1202 return this.getColor(TEXT_DECORATION_COLOR);
1206 * Sets the colour to be used for drawing text decorations
1207 * (TextDecorationColor).
1209 * @param textDecorationColor the text decoration colour
1211 public void setTextDecorationColor(PDGamma textDecorationColor)
1213 this.setColor(TEXT_DECORATION_COLOR, textDecorationColor);
1217 * Gets the thickness of each line drawn as part of the text decoration
1218 * (TextDecorationThickness).
1220 * @return the text decoration thickness
1222 public float getTextDecorationThickness()
1224 return this.getNumber(TEXT_DECORATION_THICKNESS);
1228 * Sets the thickness of each line drawn as part of the text decoration
1229 * (TextDecorationThickness).
1231 * @param textDecorationThickness the text decoration thickness
1233 public void setTextDecorationThickness(float textDecorationThickness)
1235 this.setNumber(TEXT_DECORATION_THICKNESS, textDecorationThickness);
1239 * Sets the thickness of each line drawn as part of the text decoration
1240 * (TextDecorationThickness).
1242 * @param textDecorationThickness the text decoration thickness
1244 public void setTextDecorationThickness(int textDecorationThickness)
1246 this.setNumber(TEXT_DECORATION_THICKNESS, textDecorationThickness);
1250 * Gets the type of text decoration (TextDecorationType). The default value
1251 * is {@link #TEXT_DECORATION_TYPE_NONE}.
1253 * @return the type of text decoration
1255 public String getTextDecorationType()
1257 return this.getName(TEXT_DECORATION_TYPE, TEXT_DECORATION_TYPE_NONE);
1261 * Sets the type of text decoration (TextDecorationType). The value should
1264 * <li>{@link #TEXT_DECORATION_TYPE_NONE},</li>
1265 * <li>{@link #TEXT_DECORATION_TYPE_UNDERLINE},</li>
1266 * <li>{@link #TEXT_DECORATION_TYPE_OVERLINE},</li>
1267 * <li>{@link #TEXT_DECORATION_TYPE_LINE_THROUGH}.</li>
1270 * @param textDecorationType the type of text decoration
1272 public void setTextDecorationType(String textDecorationType)
1274 this.setName(TEXT_DECORATION_TYPE, textDecorationType);
1278 * Gets the justification of the lines within a ruby assembly (RubyAlign).
1279 * The default value is {@link #RUBY_ALIGN_DISTRIBUTE}.
1281 * @return the ruby alignment
1283 public String getRubyAlign()
1285 return this.getName(RUBY_ALIGN, RUBY_ALIGN_DISTRIBUTE);
1289 * Sets the justification of the lines within a ruby assembly (RubyAlign).
1290 * The value should be one of:
1292 * <li>{@link #RUBY_ALIGN_START},</li>
1293 * <li>{@link #RUBY_ALIGN_CENTER},</li>
1294 * <li>{@link #RUBY_ALIGN_END},</li>
1295 * <li>{@link #RUBY_ALIGN_JUSTIFY},</li>
1296 * <li>{@link #RUBY_ALIGN_DISTRIBUTE},</li>
1299 * @param rubyAlign the ruby alignment
1301 public void setRubyAlign(String rubyAlign)
1303 this.setName(RUBY_ALIGN, rubyAlign);
1307 * Gets the placement of the RT structure element relative to the RB element
1308 * in a ruby assembly (RubyPosition). The default value is
1309 * {@link #RUBY_POSITION_BEFORE}.
1311 * @return the ruby position
1313 public String getRubyPosition()
1315 return this.getName(RUBY_POSITION, RUBY_POSITION_BEFORE);
1319 * Sets the placement of the RT structure element relative to the RB element
1320 * in a ruby assembly (RubyPosition). The value should be one of:
1322 * <li>{@link #RUBY_POSITION_BEFORE},</li>
1323 * <li>{@link #RUBY_POSITION_AFTER},</li>
1324 * <li>{@link #RUBY_POSITION_WARICHU},</li>
1325 * <li>{@link #RUBY_POSITION_INLINE}.</li>
1328 * @param rubyPosition the ruby position
1330 public void setRubyPosition(String rubyPosition)
1332 this.setName(RUBY_POSITION, rubyPosition);
1336 * Gets the orientation of glyphs when the inline-progression direction is
1337 * top to bottom or bottom to top (GlyphOrientationVertical). The default
1338 * value is {@link #GLYPH_ORIENTATION_VERTICAL_AUTO}.
1340 * @return the vertical glyph orientation
1342 public String getGlyphOrientationVertical()
1344 return this.getName(GLYPH_ORIENTATION_VERTICAL,
1345 GLYPH_ORIENTATION_VERTICAL_AUTO);
1349 * Sets the orientation of glyphs when the inline-progression direction is
1350 * top to bottom or bottom to top (GlyphOrientationVertical). The value
1353 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_AUTO},</li>
1354 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_MINUS_180_DEGREES},</li>
1355 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_MINUS_90_DEGREES},</li>
1356 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_ZERO_DEGREES},</li>
1357 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_90_DEGREES},</li>
1358 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_180_DEGREES},</li>
1359 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_270_DEGREES},</li>
1360 * <li>{@link #GLYPH_ORIENTATION_VERTICAL_360_DEGREES}.</li>
1363 * @param glyphOrientationVertical the vertical glyph orientation
1365 public void setGlyphOrientationVertical(String glyphOrientationVertical)
1367 this.setName(GLYPH_ORIENTATION_VERTICAL, glyphOrientationVertical);
1371 * Gets the number of columns in the content of the grouping element
1372 * (ColumnCount). The default value is 1.
1374 * @return the column count
1376 public int getColumnCount()
1378 return this.getInteger(COLUMN_COUNT, 1);
1382 * Sets the number of columns in the content of the grouping element
1385 * @param columnCount the column count
1387 public void setColumnCount(int columnCount)
1389 this.setInteger(COLUMN_COUNT, columnCount);
1393 * Gets the desired space between adjacent columns in the inline-progression
1394 * direction (ColumnGap).
1396 * @return the column gap (FLoat or array of floats)
1398 public Object getColumnGap()
1400 return this.getNumberOrArrayOfNumber(COLUMN_GAP, UNSPECIFIED);
1404 * Sets the desired space between all columns in the inline-progression
1405 * direction (ColumnGap).
1407 * @param columnGap the column gap
1409 public void setColumnGap(float columnGap)
1411 this.setNumber(COLUMN_GAP, columnGap);
1415 * Sets the desired space between all columns in the inline-progression
1416 * direction (ColumnGap).
1418 * @param columnGap the column gap
1420 public void setColumnGap(int columnGap)
1422 this.setNumber(COLUMN_GAP, columnGap);
1426 * Sets the desired space between adjacent columns in the inline-progression
1427 * direction (ColumnGap), the first element specifying the space between the
1428 * first and second columns, the second specifying the space between the
1429 * second and third columns, and so on.
1431 * @param columnGaps the column gaps
1433 public void setColumnGaps(float[] columnGaps)
1435 this.setArrayOfNumber(COLUMN_GAP, columnGaps);
1439 * Gets the desired width of the columns, measured in default user space
1440 * units in the inline-progression direction (ColumnWidths).
1442 * @return the column widths (Float or array of floats)
1444 public Object getColumnWidths()
1446 return this.getNumberOrArrayOfNumber(COLUMN_WIDTHS, UNSPECIFIED);
1450 * Sets the same column width for all columns (ColumnWidths).
1452 * @param columnWidth the column width
1454 public void setAllColumnWidths(float columnWidth)
1456 this.setNumber(COLUMN_WIDTHS, columnWidth);
1460 * Sets the same column width for all columns (ColumnWidths).
1462 * @param columnWidth the column width
1464 public void setAllColumnWidths(int columnWidth)
1466 this.setNumber(COLUMN_WIDTHS, columnWidth);
1470 * Sets the column widths for the columns separately (ColumnWidths).
1472 * @param columnWidths the column widths
1474 public void setColumnWidths(float[] columnWidths)
1476 this.setArrayOfNumber(COLUMN_WIDTHS, columnWidths);
1480 public String toString()
1482 StringBuilder sb = new StringBuilder().append(super.toString());
1483 if (this.isSpecified(PLACEMENT))
1485 sb.append(", Placement=").append(this.getPlacement());
1487 if (this.isSpecified(WRITING_MODE))
1489 sb.append(", WritingMode=").append(this.getWritingMode());
1491 if (this.isSpecified(BACKGROUND_COLOR))
1493 sb.append(", BackgroundColor=").append(this.getBackgroundColor());
1495 if (this.isSpecified(BORDER_COLOR))
1497 sb.append(", BorderColor=").append(this.getBorderColors());
1499 if (this.isSpecified(BORDER_STYLE))
1501 Object borderStyle = this.getBorderStyle();
1502 sb.append(", BorderStyle=");
1503 if (borderStyle instanceof String[])
1505 sb.append(arrayToString((String[]) borderStyle));
1509 sb.append(borderStyle);
1512 if (this.isSpecified(BORDER_THICKNESS))
1514 Object borderThickness = this.getBorderThickness();
1515 sb.append(", BorderThickness=");
1516 if (borderThickness instanceof float[])
1518 sb.append(arrayToString((float[]) borderThickness));
1522 sb.append(String.valueOf((Float) borderThickness));
1525 if (this.isSpecified(PADDING))
1527 Object padding = this.getPadding();
1528 sb.append(", Padding=");
1529 if (padding instanceof float[])
1531 sb.append(arrayToString((float[]) padding));
1535 sb.append(String.valueOf((Float) padding));
1538 if (this.isSpecified(COLOR))
1540 sb.append(", Color=").append(this.getColor());
1542 if (this.isSpecified(SPACE_BEFORE))
1544 sb.append(", SpaceBefore=")
1545 .append(String.valueOf(this.getSpaceBefore()));
1547 if (this.isSpecified(SPACE_AFTER))
1549 sb.append(", SpaceAfter=")
1550 .append(String.valueOf(this.getSpaceAfter()));
1552 if (this.isSpecified(START_INDENT))
1554 sb.append(", StartIndent=")
1555 .append(String.valueOf(this.getStartIndent()));
1557 if (this.isSpecified(END_INDENT))
1559 sb.append(", EndIndent=")
1560 .append(String.valueOf(this.getEndIndent()));
1562 if (this.isSpecified(TEXT_INDENT))
1564 sb.append(", TextIndent=")
1565 .append(String.valueOf(this.getTextIndent()));
1567 if (this.isSpecified(TEXT_ALIGN))
1569 sb.append(", TextAlign=").append(this.getTextAlign());
1571 if (this.isSpecified(BBOX))
1573 sb.append(", BBox=").append(this.getBBox());
1575 if (this.isSpecified(WIDTH))
1577 Object width = this.getWidth();
1578 sb.append(", Width=");
1579 if (width instanceof Float)
1581 sb.append(String.valueOf((Float) width));
1588 if (this.isSpecified(HEIGHT))
1590 Object height = this.getHeight();
1591 sb.append(", Height=");
1592 if (height instanceof Float)
1594 sb.append(String.valueOf((Float) height));
1601 if (this.isSpecified(BLOCK_ALIGN))
1603 sb.append(", BlockAlign=").append(this.getBlockAlign());
1605 if (this.isSpecified(INLINE_ALIGN))
1607 sb.append(", InlineAlign=").append(this.getInlineAlign());
1609 if (this.isSpecified(T_BORDER_STYLE))
1611 Object tBorderStyle = this.getTBorderStyle();
1612 sb.append(", TBorderStyle=");
1613 if (tBorderStyle instanceof String[])
1615 sb.append(arrayToString((String[]) tBorderStyle));
1619 sb.append(tBorderStyle);
1622 if (this.isSpecified(T_PADDING))
1624 Object tPadding = this.getTPadding();
1625 sb.append(", TPadding=");
1626 if (tPadding instanceof float[])
1628 sb.append(arrayToString((float[]) tPadding));
1632 sb.append(String.valueOf((Float) tPadding));
1635 if (this.isSpecified(BASELINE_SHIFT))
1637 sb.append(", BaselineShift=")
1638 .append(String.valueOf(this.getBaselineShift()));
1640 if (this.isSpecified(LINE_HEIGHT))
1642 Object lineHeight = this.getLineHeight();
1643 sb.append(", LineHeight=");
1644 if (lineHeight instanceof Float)
1646 sb.append(String.valueOf((Float) lineHeight));
1650 sb.append(lineHeight);
1653 if (this.isSpecified(TEXT_DECORATION_COLOR))
1655 sb.append(", TextDecorationColor=")
1656 .append(this.getTextDecorationColor());
1658 if (this.isSpecified(TEXT_DECORATION_THICKNESS))
1660 sb.append(", TextDecorationThickness=")
1661 .append(String.valueOf(this.getTextDecorationThickness()));
1663 if (this.isSpecified(TEXT_DECORATION_TYPE))
1665 sb.append(", TextDecorationType=")
1666 .append(this.getTextDecorationType());
1668 if (this.isSpecified(RUBY_ALIGN))
1670 sb.append(", RubyAlign=").append(this.getRubyAlign());
1672 if (this.isSpecified(RUBY_POSITION))
1674 sb.append(", RubyPosition=").append(this.getRubyPosition());
1676 if (this.isSpecified(GLYPH_ORIENTATION_VERTICAL))
1678 sb.append(", GlyphOrientationVertical=")
1679 .append(this.getGlyphOrientationVertical());
1681 if (this.isSpecified(COLUMN_COUNT))
1683 sb.append(", ColumnCount=")
1684 .append(String.valueOf(this.getColumnCount()));
1686 if (this.isSpecified(COLUMN_GAP))
1688 Object columnGap = this.getColumnGap();
1689 sb.append(", ColumnGap=");
1690 if (columnGap instanceof float[])
1692 sb.append(arrayToString((float[]) columnGap));
1696 sb.append(String.valueOf((Float) columnGap));
1699 if (this.isSpecified(COLUMN_WIDTHS))
1701 Object columnWidth = this.getColumnWidths();
1702 sb.append(", ColumnWidths=");
1703 if (columnWidth instanceof float[])
1705 sb.append(arrayToString((float[]) columnWidth));
1709 sb.append(String.valueOf((Float) columnWidth));
1712 return sb.toString();