/ PDF / PdfTextAlignment
Search results

PdfTextAlignment API in JavaScript PDF API control

Public Enum to define text alignment of text box field.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access text box field
let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
// Sets the text alignment of form field as center
field.textAlignment = PdfTextAlignment.center;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • center - Specifies the type of center.
  • justify - Specifies the type of justify.
  • left - Specifies the type of left.
  • right - Specifies the type of right.