PageBorderDistanceFrom

Inheritance: java.lang.Object

public class PageBorderDistanceFrom

Specifies the positioning of the page border relative to the page margin.

Examples:

Shows how to create a wide blue band border at the top of the first page.


 Document doc = new Document();

 PageSetup pageSetup = doc.getSections().get(0).getPageSetup();
 pageSetup.setBorderAlwaysInFront(false);
 pageSetup.setBorderDistanceFrom(PageBorderDistanceFrom.PAGE_EDGE);
 pageSetup.setBorderAppliesTo(PageBorderAppliesTo.FIRST_PAGE);

 Border border = pageSetup.getBorders().getByBorderType(BorderType.TOP);
 border.setLineStyle(LineStyle.SINGLE);
 border.setLineWidth(30.0);
 border.setColor(Color.BLUE);
 border.setDistanceFromText(0.0);

 doc.save(getArtifactsDir() + "PageSetup.PageBorderProperties.docx");
 

Fields

FieldDescription
PAGE_EDGEBorder position is measured from the page edge.
TEXTBorder position is measured from the page margin.
length

Methods

MethodDescription
fromName(String pageBorderDistanceFromName)
getName(int pageBorderDistanceFrom)
getValues()
toString(int pageBorderDistanceFrom)

PAGE_EDGE

public static int PAGE_EDGE

Border position is measured from the page edge.

TEXT

public static int TEXT

Border position is measured from the page margin.

length

public static int length

fromName(String pageBorderDistanceFromName)

public static int fromName(String pageBorderDistanceFromName)

Parameters:

ParameterTypeDescription
pageBorderDistanceFromNamejava.lang.String

Returns: int

getName(int pageBorderDistanceFrom)

public static String getName(int pageBorderDistanceFrom)

Parameters:

ParameterTypeDescription
pageBorderDistanceFromint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int pageBorderDistanceFrom)

public static String toString(int pageBorderDistanceFrom)

Parameters:

ParameterTypeDescription
pageBorderDistanceFromint

Returns: java.lang.String