# PageBorder Object

> The PageBorder represents the attributes of a border, which is drawn in the margin area of a page. A page border can have a top, left, right or bottom line or a combination of these lines. The line width and the color can be defined for each line separately. For each line a distance can be specified, which is either a distance to the edge of the page or to the text. The page border can surround the text including page headers and footers or only the text of the page. The border can be defined for the first page, for all pages or beginning with the second page.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 26.0
- **Path:** DS Server > Reference > JavaScript API > PageBorder Object
- **2045 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/llms-full.txt

---

### Description

The PageBorder represents the attributes of a border, which is drawn in the margin area of a page. A page border can have a top, left, right or bottom line or a combination of these lines. The line width and the color can be defined for each line separately. For each line a distance can be specified, which is either a distance to the edge of the page or to the text. The page border can surround the text including page headers and footers or only the text of the page. The border can be defined for the first page, for all pages or beginning with the second page.

### Syntax

```javascript
PageBorder
```

### Examples

The following example demonstrates `PageBorder` in a practical document-editing workflow. The PageBorder represents the attributes of a border, which is drawn in the margin area of a page. A page border can have a top, left, right or bottom line or a combination of these lines. The line width and the color can be defined for each line separately. For each line a distance can be specified, which is either a distance to the edge of the page or to the text. The page border can surround the text including page headers and footers or only the text of the page. The border can be defined for the first page, for all pages or beginning with the second page.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectPageBorder(pageBorder) {
    pageBorder.getBottomDistance(
        function(result) {
            console.log("get bottom distance result:", result);
        },
        onTxError
    );
}
```

---

## In This Section

- [Javascript: PageBorder.Attribute Enumeration](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/attribute-enumeration/llms-full.txt): Determines a certain page border attribute.
- [Javascript: PageBorder.getBottomDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getbottomdistance-method/llms-full.txt): Gets the distance, in twips, of the bottom border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.getBottomLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getbottomlinecolor-method/llms-full.txt): Gets the color of the bottom border line.
- [Javascript: PageBorder.getBottomLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getbottomlinewidth-method/llms-full.txt): Gets the width of the bottom border line.
- [Javascript: PageBorder.getFirstPageOnly Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getfirstpageonly-method/llms-full.txt): Gets whether the page border is drawn only on the first page of the section.
- [Javascript: PageBorder.getLeftDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getleftdistance-method/llms-full.txt): Gets the distance, in twips, of the left border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.getLeftLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getleftlinecolor-method/llms-full.txt): Gets the color of the left border line.
- [Javascript: PageBorder.getLeftLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getleftlinewidth-method/llms-full.txt): Gets the width of the left border line.
- [Javascript: PageBorder.getMeasureFromText Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getmeasurefromtext-method/llms-full.txt): Gets whether the page border's distances are measured from the text.
- [Javascript: PageBorder.getOmitFirstPage Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getomitfirstpage-method/llms-full.txt): Gets whether the page border is not drawn on the first page of the section.
- [Javascript: PageBorder.getRightDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getrightdistance-method/llms-full.txt): Gets the distance, in twips, of the right border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.getRightLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getrightlinecolor-method/llms-full.txt): Gets the color of the right border line.
- [Javascript: PageBorder.getRightLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getrightlinewidth-method/llms-full.txt): Gets the width of the right border line.
- [Javascript: PageBorder.getSurroundFooter Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getsurroundfooter-method/llms-full.txt): Gets whether the page border surrounds the section's footer.
- [Javascript: PageBorder.getSurroundHeader Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/getsurroundheader-method/llms-full.txt): Gets whether the page border surrounds the section's header.
- [Javascript: PageBorder.getTopDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/gettopdistance-method/llms-full.txt): Gets the distance, in twips, of the top border line either from the edge of the page or from the text, depending on the {@link MeasureFromText}.
- [Javascript: PageBorder.getTopLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/gettoplinecolor-method/llms-full.txt): Gets the color of the top border line.
- [Javascript: PageBorder.getTopLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/gettoplinewidth-method/llms-full.txt): Gets the width of the top border line.
- [Javascript: PageBorder.setBottomDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setbottomdistance-method/llms-full.txt): Sets the distance, in twips, of the bottom border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.setBottomLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setbottomlinecolor-method/llms-full.txt): Sets the color of the bottom border line.
- [Javascript: PageBorder.setBottomLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setbottomlinewidth-method/llms-full.txt): Sets the width of the bottom border line.
- [Javascript: PageBorder.setFirstPageOnly Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setfirstpageonly-method/llms-full.txt): Sets whether the page border is drawn only on the first page of the section.
- [Javascript: PageBorder.setLeftDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setleftdistance-method/llms-full.txt): Sets the distance, in twips, of the left border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.setLeftLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setleftlinecolor-method/llms-full.txt): Sets the color of the left border line.
- [Javascript: PageBorder.setLeftLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setleftlinewidth-method/llms-full.txt): Sets the width of the left border line.
- [Javascript: PageBorder.setMeasureFromText Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setmeasurefromtext-method/llms-full.txt): Sets whether the page border's distances are measured from the text.
- [Javascript: PageBorder.setOmitFirstPage Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setomitfirstpage-method/llms-full.txt): Sets whether the page border is not drawn on the first page of the section.
- [Javascript: PageBorder.setRightDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setrightdistance-method/llms-full.txt): Sets the distance, in twips, of the right border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.setRightLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setrightlinecolor-method/llms-full.txt): Sets the color of the right border line.
- [Javascript: PageBorder.setRightLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setrightlinewidth-method/llms-full.txt): Sets the width of the right border line.
- [Javascript: PageBorder.setSurroundFooter Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setsurroundfooter-method/llms-full.txt): Sets the whether the page border surrounds the section's footer.
- [Javascript: PageBorder.setSurroundHeader Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/setsurroundheader-method/llms-full.txt): Sets the whether the page border surrounds the section's header.
- [Javascript: PageBorder.setTopDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/settopdistance-method/llms-full.txt): Sets the distance, in twips, of the top border line either from the edge of the page or from the text, depending on the MeasureFromText.
- [Javascript: PageBorder.setTopLineColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/settoplinecolor-method/llms-full.txt): Sets the color of the top border line.
- [Javascript: PageBorder.setTopLineWidth Method](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/settoplinewidth-method/llms-full.txt): Sets the width of the top border line.

---

## Nearby

- **Previous:** [Javascript: Page.select Method](https://docs.textcontrol.com/ds-server/reference/javascript/page/select-method/llms-full.txt)
- **Next:** [Javascript: PageBorder.Attribute Enumeration](https://docs.textcontrol.com/ds-server/reference/javascript/pageborder/attribute-enumeration/llms-full.txt)
