---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Style - Scoped, Global

# Style - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 8 minutes to read

Creates a style for defining properties such font size, border, and alignment. You can apply the same style to multiple objects simultaneously.

This API is part of the ServiceNow PDF
Generation Utilities plugin (com.snc.apppdfgenerator) and is provided within the
`sn_pdfgeneratorutils` namespace. The plugin is activated by default.

This API is a component used with the [Document API](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") to generate a
PDF.  
You can apply custom styles to the following API elements:

* [Cell](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-addStyle_O "Applies a predefined style to table cells.")
* [Paragraph](https://servicenow-prod.fluidtopics.net/F66I_9eaQar0UBmo_g7irw#Paragraph-addStyle_O "Applies a predefined style to paragraph text.")
* [Table](https://servicenow-prod.fluidtopics.net/IaWzvxiBPOHtuTwBsfUUOg#Table-setDefaultStyle_O "Sets the default style to apply to the table.")
{#StyleBothAPI__ul_zmh_jyw_t4b}

## Style - Style() {#ariaid-title2}

Instantiates a new Style object.
{#Style-Style__table_twm_hjk_34b__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#Style-Style__table_twm_hjk_34b}  
The following examples shows how to create a Style object that you can
add to a [Cell](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-addStyle_O "Applies a predefined style to table cells."), [Paragraph](https://servicenow-prod.fluidtopics.net/F66I_9eaQar0UBmo_g7irw#Paragraph-addStyle_O "Applies a predefined style to paragraph text.") or [Table](https://servicenow-prod.fluidtopics.net/IaWzvxiBPOHtuTwBsfUUOg#Table-setDefaultStyle_O "Sets the default style to apply to the table.") element.

    var style = new sn_pdfgeneratorutils.Style();

## Style -- setBackgroundColor(Color color) {#ariaid-title3}

Specifies a background color of an element.
{#Style-setBackgroundColor_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Background color. |
[Table 2. Parameters]

{#Style-setBackgroundColor_O__table_vv5_52h_44b} {#Style-setBackgroundColor_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 3. Returns]

{#Style-setBackgroundColor_O__table_wv5_52h_44b}  
The following example shows how to set element background color. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var color = new sn_pdfgeneratorutils.Color([1, 0.9, 0.9]); // provided as array of RGB float values

    style.setBackGroundColor(color);

## Style -- setBold() {#ariaid-title4}

Sets a style to bold font.
{#Style-setBold__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 4. Parameters]

{#Style-setBold__table_vv5_52h_44b} {#Style-setBold__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 5. Returns]

{#Style-setBold__table_wv5_52h_44b}  
The following example shows how to set a style to bold font.

    var style = new sn_pdfgeneratorutils.Style();
    style.setBold();

## Style -- setBorder(Number width) {#ariaid-title5}

Sets the style border on all four sides of an element.
{#Style-setBorder_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
[Table 6. Parameters]

{#Style-setBorder_N__table_vv5_52h_44b} {#Style-setBorder_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 7. Returns]

{#Style-setBorder_N__table_wv5_52h_44b}  
The following example shows how to set a style border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 2;

    style.setBorder(width);

## Style -- setBorderBottom(Number width) {#ariaid-title6}

Sets the style border to the bottom of an element.
{#Style-setBorderBottom_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
[Table 8. Parameters]

{#Style-setBorderBottom_N__table_vv5_52h_44b} {#Style-setBorderBottom_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 9. Returns]

{#Style-setBorderBottom_N__table_wv5_52h_44b}  
The following example shows how to set a style border to the bottom of an element. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 2;

    style.setBorderBottom(width);

## Style -- setBorderLeft(Number width) {#ariaid-title7}

Sets the style border on the left side of an element.
{#Style-setBorderLeft_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
[Table 10. Parameters]

{#Style-setBorderLeft_N__table_vv5_52h_44b} {#Style-setBorderLeft_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 11. Returns]

{#Style-setBorderLeft_N__table_wv5_52h_44b}  
The following example shows how to set a style border on the left side of an element. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 2;

    style.setBorderLeft(width);

## Style -- setBorderRight(Number width) {#ariaid-title8}

Sets the style border on the right side of an element.
{#Style-setBorderRight_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
[Table 12. Parameters]

{#Style-setBorderRight_N__table_vv5_52h_44b} {#Style-setBorderRight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 13. Returns]

{#Style-setBorderRight_N__table_wv5_52h_44b}  
The following example shows how to set a style border on the right side of an element. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 2;

    style.setBorderRight(width);

## Style -- setBorderTop(Number width) {#ariaid-title9}

Sets the style border to the top of an element.
{#Style-setBorderTop_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
[Table 14. Parameters]

{#Style-setBorderTop_N__table_vv5_52h_44b} {#Style-setBorderTop_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 15. Returns]

{#Style-setBorderTop_N__table_wv5_52h_44b}  
The following example shows how to set a style border to the top of an element. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 2;

    style.setBorderTop(width);

## Style -- setColoredBorder(Number width, Color color) {#ariaid-title10}

Sets style border with color on all four sides of an element.
{#Style-setColoredBorder_N_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Style border color. |
[Table 16. Parameters]

{#Style-setColoredBorder_N_O__table_vv5_52h_44b} {#Style-setColoredBorder_N_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 17. Returns]

{#Style-setColoredBorder_N_O__table_wv5_52h_44b}  
The following example shows how to set a style border with color. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 1.0;
    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);

    style.setColoredBorder(width, borderColor);

## Style -- setColoredBorderBottom(Number width, Color color) {#ariaid-title11}

Sets style border with color to the bottom side of an element.
{#Style-setColoredBorderBottom_N_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Style border color. |
[Table 18. Parameters]

{#Style-setColoredBorderBottom_N_O__table_vv5_52h_44b} {#Style-setColoredBorderBottom_N_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 19. Returns]

{#Style-setColoredBorderBottom_N_O__table_wv5_52h_44b}  
The following example shows how to set a style border to the bottom of an element.For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 1.0;
    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);

    style.setColoredBorderBottom(width, borderColor);

## Style -- setColoredBorderLeft(Number width, Color color) {#ariaid-title12}

Sets style border with color on the left side of an element.
{#Style-setColoredBorderLeft_N_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Style border color. |
[Table 20. Parameters]

{#Style-setColoredBorderLeft_N_O__table_vv5_52h_44b} {#Style-setColoredBorderLeft_N_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 21. Returns]

{#Style-setColoredBorderLeft_N_O__table_wv5_52h_44b}  
The following example shows how to set a style border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 1.0;
    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);

    style.setColoredBorderLeft(width, borderColor);

## Style -- setColoredBorderRight(Number width, Color color) {#ariaid-title13}

Sets style border with color on the right side of an element.
{#Style-setColoredBorderRight_N_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Style border color. |
[Table 22. Parameters]

{#Style-setColoredBorderRight_N_O__table_vv5_52h_44b} {#Style-setColoredBorderRight_N_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 23. Returns]

{#Style-setColoredBorderRight_N_O__table_wv5_52h_44b}  
The following example shows how to set a style border with color. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 1.0;
    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);

    style.setColoredBorderRight(width, borderColor);

## Style -- setColoredBorderTop(Number width, Color color) {#ariaid-title14}

Sets style border with color to the top side of an element.
{#Style-setColoredBorderTop_N_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Style border width in points. |
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Style border color. |
[Table 24. Parameters]

{#Style-setColoredBorderTop_N_O__table_vv5_52h_44b} {#Style-setColoredBorderTop_N_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 25. Returns]

{#Style-setColoredBorderTop_N_O__table_wv5_52h_44b}  
The following example shows how to set a style border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var width = 1.0;
    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);

    style.setColoredBorderTop(width, borderColor);

## Style -- setFontColor(Color color) {#ariaid-title15}

Sets a font color.
{#Style-setFontColor_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Font color. |
[Table 26. Parameters]

{#Style-setFontColor_O__table_vv5_52h_44b} {#Style-setFontColor_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 27. Returns]

{#Style-setFontColor_O__table_wv5_52h_44b}  
The following example shows how to set a font color. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var fontColor = new sn_pdfgeneratorutils.Color([1,0.5,0.5]);

    style.setFontColor(fontColor);

## Style -- setFontSize(Number fontSize) {#ariaid-title16}

Sets a style font size.
{#Style-setFontSize_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| fontSize | Number | Font size in points. |
[Table 28. Parameters]

{#Style-setFontSize_N__table_vv5_52h_44b} {#Style-setFontSize_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 29. Returns]

{#Style-setFontSize_N__table_wv5_52h_44b}  
The following example shows how to set a font size.

    var style = new sn_pdfgeneratorutils.Style();

    style.setFontSize(12);

## Style -- setHorizontalAlignment(String alignment) {#ariaid-title17}

Sets the horizontal alignment for a style.
{#Style-setHorizontalAlignment_S__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| alignment | String | Horizontal alignment setting. Valid values: * center: Align contents to the center. * left: Align contents to the left. * right: Align contents to the right. {#Style-setHorizontalAlignment_S__ul_i43_swq_p4b} |
[Table 30. Parameters]

{#Style-setHorizontalAlignment_S__table_vv5_52h_44b} {#Style-setHorizontalAlignment_S__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 31. Returns]

{#Style-setHorizontalAlignment_S__table_wv5_52h_44b}  
The following example shows how to set horizontal alignment on an element. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var alignment = "Center";

    style.setHorizontalAlignment(alignment);

## Style -- setItalic() {#ariaid-title18}

Sets a style to italic font.
{#Style-setItalic__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 32. Parameters]

{#Style-setItalic__table_vv5_52h_44b} {#Style-setItalic__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 33. Returns]

{#Style-setItalic__table_wv5_52h_44b}  
The following example shows how to set an element style to an italic font.

    var style = new sn_pdfgeneratorutils.Style();
    style.setItalic();

## Style -- setPadding(Number padding) {#ariaid-title19}

Sets the padding of all four sides of an element to the same width.
See also:

* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingBottom_N "Sets the value of the bottom padding width of an element.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingLeft_N "Sets the value of the left padding width of an element.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingRight_N "Sets the value of the right padding width of a style.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingTop_N "Sets the value of the top padding width of an element.")
{#Style-setPadding_N__ul_rjs_hgr_p4b}
{#Style-setPadding_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 34. Parameters]

{#Style-setPadding_N__table_vv5_52h_44b} {#Style-setPadding_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 35. Returns]

{#Style-setPadding_N__table_wv5_52h_44b}  
The following example shows how to set bottom style to 2.5 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var padding = 2.5;

    style.setPadding(padding);

## Style -- setPaddingBottom(Number padding) {#ariaid-title20}

Sets the value of the bottom padding width of an element.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPadding_N "Sets the padding of all four sides of an element to the same width.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingLeft_N "Sets the value of the left padding width of an element.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingRight_N "Sets the value of the right padding width of a style.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingTop_N "Sets the value of the top padding width of an element.")
{#Style-setPaddingBottom_N__ul_rjs_hgr_p4b}
{#Style-setPaddingBottom_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 36. Parameters]

{#Style-setPaddingBottom_N__table_vv5_52h_44b} {#Style-setPaddingBottom_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 37. Returns]

{#Style-setPaddingBottom_N__table_wv5_52h_44b}  
The following example shows how to set bottom element padding to 2.5 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var padding = 2.5;

    style.setPaddingBottom(padding);

## Style -- setPaddingLeft(Number padding) {#ariaid-title21}

Sets the value of the left padding width of an element.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPadding_N "Sets the padding of all four sides of an element to the same width.")
* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingBottom_N "Sets the value of the bottom padding width of an element.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingRight_N "Sets the value of the right padding width of a style.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingTop_N "Sets the value of the top padding width of an element.")
{#Style-setPaddingLeft_N__ul_rjs_hgr_p4b}
{#Style-setPaddingLeft_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 38. Parameters]

{#Style-setPaddingLeft_N__table_vv5_52h_44b} {#Style-setPaddingLeft_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 39. Returns]

{#Style-setPaddingLeft_N__table_wv5_52h_44b}  
The following example shows how to set left element padding to 2.5 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var padding = 2.5;

    style.setPaddingLeft(padding);

## Style -- setPaddingRight(Number padding) {#ariaid-title22}

Sets the value of the right padding width of a style.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPadding_N "Sets the padding of all four sides of an element to the same width.")
* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingBottom_N "Sets the value of the bottom padding width of an element.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingLeft_N "Sets the value of the left padding width of an element.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingTop_N "Sets the value of the top padding width of an element.")
{#Style-setPaddingRight_N__ul_ydd_f4r_p4b}
{#Style-setPaddingRight_N__table_x2n_v4g_r4b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 40. Parameters]

{#Style-setPaddingRight_N__table_x2n_v4g_r4b} {#Style-setPaddingRight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 41. Returns]

{#Style-setPaddingRight_N__table_wv5_52h_44b}  
The following example shows how to set right element padding to 2.5 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var padding = 2.5;

    style.setPaddingRight(padding);

## Style -- setPaddingTop(Number padding) {#ariaid-title23}

Sets the value of the top padding width of an element.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPadding_N "Sets the padding of all four sides of an element to the same width.")
* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingBottom_N "Sets the value of the bottom padding width of an element.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingLeft_N "Sets the value of the left padding width of an element.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#Style-setPaddingRight_N "Sets the value of the right padding width of a style.")
{#Style-setPaddingTop_N__ul_rjs_hgr_p4b}
{#Style-setPaddingTop_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 42. Parameters]

{#Style-setPaddingTop_N__table_vv5_52h_44b} {#Style-setPaddingTop_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 43. Returns]

{#Style-setPaddingTop_N__table_wv5_52h_44b}  
The following example shows how to set top element padding to 2.5 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var padding = 2.5;

    style.setPaddingTop(padding);

## Style -- setTextAlignment(String alignment) {#ariaid-title24}

Sets the text alignment for a style.
{#Style-setTextAlignment_S__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| alignment | String | Text alignment position. Valid values: * text-center: Aligns text to the center. * text-justified: Modifies the space between characters to completely fill text between the left and right sides. The final line is left-aligned. * text-justified-all: Justifies text alignment including the final line. * text-left: Align text to the left. * text-right: Align text to the right. {#Style-setTextAlignment_S__ul_sgj_44p_p4b} |
[Table 44. Parameters]

{#Style-setTextAlignment_S__table_vv5_52h_44b} {#Style-setTextAlignment_S__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 45. Returns]

{#Style-setTextAlignment_S__table_wv5_52h_44b}  
The following example shows how to set the element text to center alignment.

    var style = new sn_pdfgeneratorutils.Style();

    String alignment = "text-center";

    style.setTextAlignment(alignment);

## Style -- setVerticalAlignment(String alignment) {#ariaid-title25}

Sets the vertical alignment for this element.
{#Style-setVerticalAlignment_S__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| alignment | String | Vertical alignment setting. Valid values: * bottom: Aligns contents to the bottom. * mid: Aligns contents to the center. * top: Aligns contents to the top. {#Style-setVerticalAlignment_S__ul_ifh_p5q_p4b} |
[Table 46. Parameters]

{#Style-setVerticalAlignment_S__table_vv5_52h_44b} {#Style-setVerticalAlignment_S__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 47. Returns]

{#Style-setVerticalAlignment_S__table_wv5_52h_44b}  
The following example shows how to set vertical alignment on an element. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var style = new sn_pdfgeneratorutils.Style();

    var alignment = "Mid";

    style.setVerticalAlignment(alignment);


