public static void addIndent(Paragraph paragraph, StringBuilder style) { addIndent(style, "text-indent", paragraph.getFirstLineIndent()); addIndent(style, "margin-left", paragraph.getIndentFromLeft()); addIndent(style, "margin-right", paragraph.getIndentFromRight()); addIndent(style, "margin-top", paragraph.getSpacingBefore()); addIndent(style, "margin-bottom", paragraph.getSpacingAfter()); }
public static void addParagraphProperties(Paragraph paragraph, StringBuilder style) { addIndent(paragraph, style); addJustification(paragraph, style); addBorder(paragraph.getBottomBorder(), "bottom", style); addBorder(paragraph.getLeftBorder(), "left", style); addBorder(paragraph.getRightBorder(), "right", style); addBorder(paragraph.getTopBorder(), "top", style); if (paragraph.pageBreakBefore()) { style.append("break-before:page;"); } style.append("hyphenate:" + (paragraph.isAutoHyphenated() ? "auto" : "none") + ";"); if (paragraph.keepOnPage()) { style.append("keep-together.within-page:always;"); } if (paragraph.keepWithNext()) { style.append("keep-with-next.within-page:always;"); } }
public static void addJustification(Paragraph paragraph, final StringBuilder style) { String justification = getJustification(paragraph.getJustification()); if (isNotEmpty(justification)) style.append("text-align:" + justification + ";"); }